简体   繁体   English

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

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

I want to be able to edit grid colums inline as it is shown in a simple grid example in AppSDK docs https://developer.help.rallydev.com/apps/2.0rc1/doc/#!/example/Grid but it looks like that this functionality is not available by default if when a custom store is used: 我希望能够内联编辑网格列,如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...
        ]
    });
}

In my app when I click on the Name the field does not become editable as it is in the simple grid example. 在我的应用程序中,当我单击“名称”时,该字段不会像在简单网格示例中那样变为可编辑的。

The code can be modified as follows to add inline edit capability: set editor to 'textfield' for the Name column, set grid's selType to 'cellmodel', and instantiate CellEditing plugin. 可以按如下方式修改代码,以添加内联编辑功能:将“名称”列的编辑器设置为“ 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
                })
            ]

        });
    }

Please see documentation on Ext.grid.plugin.CellEditing here 请在此处查看有关Ext.grid.plugin.CellEditing的文档

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

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