var ItemRecord = Ext.data.Record.create([
{name:'itemid'},
{name:'itemcode'},
{name:'itemname'},
{name:'price'},
{name:'mark'}
])
//点新增按钮时则执行类似如下函数
function addNewLine2Grid(grid){
var rec = new ItemRecord({ //实例化Record对象,并赋予各字段初始值
'itemid': 0,
'itemcode': '',
'itemname': '',
'price': 0.00,
'mark': ''
})
grid.store.insert(grid.store.getCount(), rec) //插入新行作为grid最后一行
grid.getView().refresh()//刷新
//grid.plugins[1].startEditing(grid.store.getCount()-1,4)//编辑最后一行第4列
}
function addColumn(){var grid = Ext.getCmp('gridPanelID')
var stores = grid.getStore()
var recordType = grid.getStore().recordType
var data = new recordType()
grid.stopEditing()
stores.insert(0, data)
stores.sort()
grid.getView().refresh()
grid.startEditing(0, 0)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)