请帮忙。 我正在使用 extjs。目前我的可编辑网格有两个按钮(“更新”和“取消”)我需要添加新按钮“保存和下一步”(保存当前行并使下一行可编辑)在可编辑网格中。有人可以帮我实现这个目标吗。
最佳答案
如果你分享你的代码,那么我可以给你最好的答案。我已经编写了单击按钮时编辑行的代码(在网格中作为操作列)。在编辑代码之前,您可以编写用于将数据保存到所需位置的代码。
Ext.application({
name: 'Fiddle',
launch: function() {
var studentStore = Ext.create('Ext.data.Store', {
autoLoad: 'false',
fields: [
{name: 'studentId'},
{name: 'name'},
{name: 'age'}
],
data:[
{'studentId': 1, 'name': 'Puneet', 'age': 25}
]
});
cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToMoveEditor: 1,
autoCancel: false
});
Ext.create('Ext.window.Window', {
title: 'Row Editing Grid',
height: 400,
width: 400,
items: [{
xtype: 'grid',
height: 400,
store:studentStore,
plugins: [cellEditing],
columns:[
{
xtype: 'actioncolumn',
items:[
{
text:'Add New Row',
tooltip: 'Add Row',
icon: 'add.png',
handler: function(grid, rowIndex, colIndex){
grid.store.add({});
var rowIndex = grid.store.data.items.length - 1;
cellEditing.startEdit(rowIndex,1);
}
}
]
},
{
header: 'StudentId',
dataIndex: 'studentId',
editor:{
xtype: 'textfield'
}
},
{
header: 'Name',
dataIndex: 'name',
editor:{
xtype: 'textfield'
}
},
{
header: 'Age',
dataIndex: 'age',
editor:{
xtype: 'textfield'
}
}
]
}]
}).show();
}
});
关于javascript - 除了 extjs 的可编辑网格中给出的更新和取消之外,添加新按钮 "Save and Next",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30844617/