使用combobox存储缓冲和pageSize问题。 (使用ExtJs 4.2.0版本)

时间:2013-08-20 12:47:15

标签: extjs

我只是从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',           领域:[               {name:'id',mapping:'post_id'},               {name:'title',mapping:'topic_title'},               {name:'topicId',mapping:'topic_id'},               {name:'author',mapping:'author'},               {name:'lastPost',mapping:'post_time',type:'date',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”)]}
由{author} {title}

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

当我评论buffered:true时,这个小提琴工作正常。

但是当你愿意:

  1. 取消注释缓冲:来自商店的真实。

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

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

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

1 个答案:

答案 0 :(得分: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

相关问题