具有分页的ExtJS网格,而不是组合框

时间:2011-08-04 19:03:08

标签: javascript extjs combobox grid multi-select

我正在创建一个项目列表,这些项目在组合框中,但我被要求用网格创建它并包含分页。是否可以创建一个包含项目列表的网格,然后像在下拉菜单中选择它们(具有多选功能),单击提交按钮获取值并通过php文件处理它。?

我的想法:网格用于显示信息列表,网格中的文本可以是链接文本。但据我所知,你无法从网格中选择项目,然后点击提交按钮进行处理。

无论如何,最好的方法是什么?如果两种方法都不可能,我可以使用multiselect来制作列表吗?使用displayfield和valuefield?

1 个答案:

答案 0 :(得分:2)

好吧,您可以为网格中的每个项目添加复选框,然后对所选项目执行某些操作。

Ext.define('Your.items.Grid' ,{
    extend: 'Ext.grid.Panel',

    title : 'Grid with checkboxes',
    store: 'Items',
    // This line adds checkboxes
    selModel: Ext.create('Ext.selection.CheckboxModel'), 

    columns: [
         // Some columns here
    ],    
    initComponent: function() {

        this.dockedItems = [{
            xtype: 'toolbar',
            items: [{
                itemId: 'process',
                text: 'Process',
                action: 'process' // Bind to some action and then process
            }]
        },
        { // Here is pagination
            xtype: 'pagingtoolbar',
            dock:'top',
            store: 'Items',
            displayInfo: true,
            displayMsg: 'Displaying items {0} - {1} of {2}',
            emptyMsg: "No items to display"
        }];            
        this.callParent(arguments);
    }
});

希望我能正确理解你的问题