2014-06-23 82 views
3

我在网格面板编辑器单元格中使用了远程存储的combobox(我使用rowEditing插件)。通过使用组合框的“pageSize”属性,我在扩展组合框的底部有了pagingtoolbar。ExtJs combobox pagingtoolbar properties

例如: http://docs.sencha.com/extjs/4.2.2/#!/example/form/forum-search.html

我需要改变这个pagingtoolbar的一些性质,例如 “beforePageText”, “afterPageText”, “displayMsg” 等。在网格面板中,我可以添加dockedItems并设置任何属性,但是combobox呢?没有配置。

感谢您的回复和帮助。

var store = Ext.create('Ext.data.ArrayStore', { 
         fields: ['ID', 'NAME'], 
         pageSize: 10, 
         autoLoad: false, 
         proxy: { 
          type: 'ajax', 
          url: 'someurl' 
          reader: { 
           type: 'json', 
           root: 'data' 
          } 
         } 
        }); 

//And properties of my column editor 

gridColumn.editor.xtype = 'combobox'; 
gridColumn.editor.store = store; 
//with this we have pagingtoolbar at the bottom of combobox 
gridColumn.editor.pageSize = 20; 
gridColumn.editor.valueField = 'ID'; 
gridColumn.editor.displayField = 'ID'; 

回答

3

不幸的是,分页工具栏的配置是不容易的。该分页是作为BoundList创建(即组合选择器)的一部分而创建的,并且没有配置选项得到遵守。见BoundList来源:

createPagingToolbar: function() { 
    return Ext.widget('pagingtoolbar', { 
     id: this.id + '-paging-toolbar', 
     pageSize: this.pageSize, 
     store: this.dataSource, 
     border: false, 
     ownerCt: this, 
     ownerLayout: this.getComponentLayout() 
    }); 
} 

您可以配置在组合自己picker但它不记录配置选项,或者您可以覆盖createPicker()方法 - 也没有记载。

+0

感谢您的回答。请告诉我为什么我不能重写“createPagingToolbar”函数? – tytyryty

+0

当然,你可以,但是这样做会改变它的所有组合 - 一切都很好,如果你想要的。如果你只想要一个或几个组合,那么自己的选择器或者覆盖createPicker就更好。 – Saki

+0

但重写“createPicker”也会更改所有组合框,不是吗?我的意思是这样的重写'Ext.define('ExtApp.form.field.ComboBox',{ override:'Ext.form.field.ComboBox', createPicker:function(){// override}); ' – tytyryty