0

我只是从 ExtJs 4.1.0 迁移到 ExtJs 4.2.0,我遇到了以下问题

在我们的应用程序中,我们使用 Combobox 创建了一个自定义选择器。我们在选择器中添加了 Grid。这个选择器在 ExtJs 4.1.0 中运行良好,但是当我替换库即 ExtJs 4.2.0 时它的行为非常奇怪。

实际上,我们在 Combobox 存储中使用了 buffered: true (在我们的例子中是 Custom Picker )。这在 ExtJs 4.2.0 中造成了问题。

请查看这个证明我的问题的小提琴: Demo

Ext.onReady(function () { Ext.define("Post", { extend: 'Ext.data.Model', fields: [ {name: 'id', mapping: 'post_id'}, {name: 'title' ,映射:'topic_title'},{name:'topicId',映射:'topic_id'},{name:'author',映射:'author'},{name:'lastPost',映射:'post_time',类型: '日期', dateFormat: 'timestamp'}, {name: 'excerpt', mapping: 'post_text'} ] });

ds = Ext.create('Ext.data.Store', {
    pageSize: 10,
    model: 'Post',
    //buffered: true,
    leadingBufferZone: 10,
    proxy: {
        type: 'jsonp',
        url : 'http://www.sencha.com/forum/topics-remote.php',
        reader: {
            type: 'json',
            root: 'topics',
            totalProperty: 'totalCount'
        }
    }
});

panel = Ext.create('Ext.panel.Panel', {
    renderTo: Ext.getBody(),
    title: 'Search the Ext Forums',
    width: 600,
    bodyPadding: 10,
    layout: 'anchor',

    items: [{
        xtype: 'combo',
        store: ds,
        displayField: 'title',
        typeAhead: false,
        hideLabel: true,
        hideTrigger:false,
        anchor: '100%',
        pageSize: 10,
        listConfig: {
            loadingText: 'Searching...',
            emptyText: 'No matching posts found.',

            // Custom rendering template for each item
            getInnerTpl: function() {
                return '<a class="search-item" href="http://www.sencha.com/forum/showthread.php?t={topicId}&p={id}">'

+ '

{[Ext.Date.format(values.lastPost, "M j, Y")]}
by {author}{title}

' + '{摘录}' + ''; } } }, { xtype: 'component', style: 'margin-top:10px', html: '实时搜索至少需要 4 个字符。' }] }); });

当我评论缓冲时,这个小提琴工作正常:真。

但是当你会:

  1. 取消注释 buffered:true 从商店。

  2. 并评论 pageSize 正在创建组合框(不在商店中)。

    然后你会发现不会有结果获取(ExtJs 4.2.0)。同样的场景在 ExtJs 4.1.0 中运行良好。

    如果它与 ExtJs 4.1.0 一起工作,那么为什么不与 ExtJs 4.2.0 一起工作。这是 ExtJs 4.2.0. 请帮助我。提前致谢。

4

1 回答 1

0

据我所知,组合框不支持缓冲存储。您需要在组合中实际渲染一个网格并为网格使用缓冲存储......组合本身不会有存储。

看到这篇文章http://www.sencha.com/forum/showthread.php?248251

这是一个插件,可以帮助你做你想做的事http://www.sencha.com/forum/showthread.php?140667-Put-A-Grid-In-ComboBox-%E2%80%94%E2%80% 94-Magic-GridCombo

于 2013-08-20T16:28:37.520 回答