EXTJS store 某行某列数据更新等操作

mac2022-06-30  72

1.可以使用add(Ext.data.Record[] records)或者add(Ext.data.Record record)向store末尾添加一个或多个record。如: 

var newRecord=new PersonRecord({name:"Tom",age:22}); store.add(newRecord);

2.add函数会将新的数据添加到store的末尾,这对其原有的排序方式可能造成破坏,如果希望保持有序,应使用addSorted,调用方法与add相同。可以使用insert方法将记录插入到指定的位置,如:

var newRecord=new PersonRecord({name:"Tom",age:22}); store.insert(store.getCount(),newRecord);

3.删除操作可以使用remove和removeAll函数,如: 

store.remove(store.getAt(0)); store.removeAll();

4.修改store中的数据:

store.getAt(0).set("name","Jesse");

 5.grid 中的下拉框

{ header: '属性值', dataIndex: 'PropertyValueName', width: 130, /* 指定Editor类型是'combo' */ editor: Ext.create('Ext.form.field.ComboBox', { name: 'PropertyValueId', typeAhead: true, store: comboData_DynaPropertyValue, valueField: "PropertyValueId", displayField: "PropertyValueName", queryMode: 'remote', //local remote triggerAction: 'all', lazyRender: true, repeatTriggerClick: true, listeners: { "expand": function (combo, store, index) { var selectedData = grid_DynaProperty.getSelectionModel().getSelection()[0].data; comboData_DynaPropertyValue.load({ params: { PropertyId: selectedData.PropId, start: startDynaProperty, limit: limitDynaProperty } }); }, change: function (field, newValue, oldValue, op) { //当下拉框选择改变的时候,也就是原值不等于新值时 if (newValue != oldValue) { alert(newValue); grid_DynaProperty.getSelectionModel().getSelection()[0].set("PropertyValueName", newValue); grid_DynaProperty.getSelectionModel().getSelection()[0].set("PropertyValueId", newValue); } } } }) }

 

转载于:https://www.cnblogs.com/foreverfendou/p/4643287.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)