ext 动态增加grid内容

 

var store = Ext.getCmp('gridPanelId').getStore();

 

var value1 = "";

var value2 = "";

//增加grid中数据

var onerecord = store.recordType;

var data = new onerecord({

header1: value1,

header2 : value2

});

store.add(data);

 

//删除grid中数据

 

var sm = Ext.getCmp('gridPanelId').getSelectionModel();

if(sm.hasSelection()){

var selectRecord = sm.getSelected();

var store = Ext.getCmp('gridPanelId').getStore();

store.remove(selectRecord);

}

 

 

grid 需要 CheckboxSelectionModel 对象 否则,会报错哦 

你可能感兴趣的:(grid store)