繁体   English   中英

使用自定义存储时如何使网格列可编辑

[英]how to make a grid column editable when using custom store

我希望能够内联编辑网格列,如AppSDK文档中的简单网格示例所示:https://developer.help.rallydev.com/apps/2.0rc1/doc/#!/ example/Grid但它看起来例如,如果使用自定义商店,则默认情况下此功能不可用:

_createGrid: function(stories) {
     this.add({
        xtype: 'rallygrid',
        store: Ext.create('Rally.data.custom.Store', {
            data: stories,
            pageSize: 100
        }),
        columnCfgs: [
            {
               text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
            },
            {
                text: 'Name', dataIndex: 'Name'
            },
            //other columns...
        ]
    });
}

在我的应用程序中,当我单击“名称”时,该字段不会像在简单网格示例中那样变为可编辑的。

可以按如下方式修改代码,以添加内联编辑功能:将“名称”列的编辑器设置为“ textfield”,将网格的selType设置为“ cellmodel”,并实例化CellEditing插件。

_createGrid: function(stories) {
         this.add({
            xtype: 'rallygrid',
            store: Ext.create('Rally.data.custom.Store', {
                data: stories,
                pageSize: 100
            }),
            columnCfgs: [
                {
                   text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },
                {
                    text: 'Name', dataIndex: 'Name', editor: 'textfield'
                }
        //other columns...
            ],
            selType: 'cellmodel',
            plugins: [
                Ext.create('Ext.grid.plugin.CellEditing', {
                clicksToEdit: 1
                })
            ]

        });
    }

请在此处查看有关Ext.grid.plugin.CellEditing的文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM