superbinary
14 Jul 2010, 7:02 PM
the insert not works. and i really can't figure out what's wrong:(... thanks very much.
Ext.onReady(
function()
{
IniTargetGrid();
});
function IniTargetGrid()
{
var targetRecord = Ext.data.Record.create([
{name:'col_id',type:'string'},
{name:'col_book',type:'string'},
{name:'col_chapter',type:'string'},
{name:'col_target',type:'string'}
]);
var targetData=[['id0','book0','chapter0','target0']];
var targetStore = new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(targetData),
reader:new Ext.data.ArrayReader({},targetRecord)
});
targetStore.load();
var targetCm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header:'book',dataIndex:'col_book'},
{header:'chapter',dataIndex:'col_chapter'},
{header:'target',dataIndex:'col_target'}
]);
var targetGrid = new Ext.grid.EditorGridPanel({
renderTo:'target_grid',
cm:targetCm,
store:targetStore,
tbar: [{
text: 'add',
handler: function(){
var e = new targetRecord({
col_id:3,
col_book: 'a',
col_chapter: 'a',
col_target: 'a'
});
targetGrid.stopEditing();
targetStore.insert(0,e);
targetGrid.startEditing(0,0);
}
}]
});
}
Ext.onReady(
function()
{
IniTargetGrid();
});
function IniTargetGrid()
{
var targetRecord = Ext.data.Record.create([
{name:'col_id',type:'string'},
{name:'col_book',type:'string'},
{name:'col_chapter',type:'string'},
{name:'col_target',type:'string'}
]);
var targetData=[['id0','book0','chapter0','target0']];
var targetStore = new Ext.data.Store({
proxy:new Ext.data.MemoryProxy(targetData),
reader:new Ext.data.ArrayReader({},targetRecord)
});
targetStore.load();
var targetCm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
{header:'book',dataIndex:'col_book'},
{header:'chapter',dataIndex:'col_chapter'},
{header:'target',dataIndex:'col_target'}
]);
var targetGrid = new Ext.grid.EditorGridPanel({
renderTo:'target_grid',
cm:targetCm,
store:targetStore,
tbar: [{
text: 'add',
handler: function(){
var e = new targetRecord({
col_id:3,
col_book: 'a',
col_chapter: 'a',
col_target: 'a'
});
targetGrid.stopEditing();
targetStore.insert(0,e);
targetGrid.startEditing(0,0);
}
}]
});
}