在单元格编辑时获取extjs中的行数据
Get row data in extjs on cell edit
我正在创建一个Extjs网格。其中大部分列是可编辑的。我需要的是,如果用户在模糊上更改任何列值,我会调用我的方法,根据其他列值进行一些计算。并将列值替换为计算值。代码在这里。
var incomeTaxOverrideModel = new Ext.grid.ColumnModel([{
id : 'fromDate',
header : "From Date",
dataIndex : 'fromDate',
width : 80,
renderer : drenderer,
editor : this.fromDateEditor
}, {
id : 'toDate',
header : "To Date",
dataIndex : 'toDate',
width : 80,
renderer : drenderer,
editor : this.toDateEditor
}, {
id : 'rawTax',
header : "Raw Tax",
dataIndex : 'rawTax',
width : 80,
align : 'right',
selectOnFocus : true,
editor : new Ext.form.NumberField({"blur":this.calculateTaxForword}),
renderer : Gts.payItemRenderer()
}, {
id : 'surcharge',
header : "Surcharge",
dataIndex : 'surcharge',
width : 80,
align : 'right',
selectOnFocus : true,
editor : new Ext.form.NumberField({}),
renderer : Gts.payItemRenderer()
}, {
id : 'cess',
header : "Cess",
dataIndex : 'cess',
width : 80,
align : 'right',
selectOnFocus : true,
editor : new Ext.form.NumberField({}),
renderer : Gts.payItemRenderer()
}, {
id : 'totalTax',
header : "Total Tax",
dataIndex : 'totalTax',
width : 80,
align : 'right',
selectOnFocus : true,
editor : new Ext.form.NumberField({}),
renderer : Gts.payItemRenderer()
}, {
id : 'taxAmount',
header : "Taxable Income",
dataIndex : 'taxAmount',
width : 100,
align : 'right',
selectOnFocus : true,
editor : new Ext.form.NumberField({}),
renderer : Gts.payItemRenderer()
}, {
id : 'remarks',
header : "Remarks",
dataIndex : 'remarks',
width : 250,
editor : new Ext.form.TextField({})
}, {
id : 'modifiedDate',
header : "Modified On",
dataIndex : 'modifiedDate',
width : 100,
renderer : Ext.util.Format.dateRenderer('d M Y h:i:s A'),
width : 150
}
]);
this.itoGrid = new Ext.grid.EditorGridPanel({
store : this.itoStore,
cm : incomeTaxOverrideModel,
autoExpandColumn : 'remarks',
autoScroll : true,
containerScroll : true,
frame : false,
stripeRows : true,
width : 830,
height : 233,
clicksToEdit : 1,
layout : 'fit',
loadMask : true,
tbar : [this.addAction, this.deleteAction],
trackMouseOver : true
});
我在方法上创建
calculateTaxForword :function(){
console.log(this.itoGrid)
//console.log(this.itoGrid.getStore().getModifiedRecords())
}
但没有任何结果。我必须根据原始税、采购费和加工费来计算价值,所以我需要我的方法中的所有价值。如何做到这一点,任何人都请帮助
CellEditing
插件有一个beforeedit
事件,您可以监听:http://docs.sencha.com/ext-js/4-1/#/api/Ext.grid.plugin.CellEditing-event-bforeedit
这将使您可以访问以下内容:
Parameters
editor : Ext.grid.plugin.CellEditing
e : Object
An edit event with the following properties:
grid - The grid
record - The record being edited
field - The field name being edited
value - The value for the field being edited.
row - The grid table row
column - The grid Column defining the column that is being edited.
rowIdx - The row index that is being edited
colIdx - The column index that is being edited
cancel - Set this to true to cancel the edit or return false from your handler.
eOpts : Object - The options object passed to Ext.util.Observable.addListener.
每个列对象都有editingPlugin.activeRecord
属性和记录本身。
相关文章:
- 如何将本地json数据加载到Extjs数据模型中
- 如何使用输入数据加载新的extjs图表
- ExtJS网格未从Ext.data.XmlStore加载数据
- ExtJs 4 GridPanel with CellEdit:输入的数据在验证失败时丢失
- 将数据加载到存储后,Extjs组合框为空
- 将数据从服务器端加载到 ExtJs 网格中
- Extjs树面板未加载json数据
- Extjs 4,如何使用单个Json文件为多个动态网格发送多个元数据
- PagingToolbar的Extjs问题-下一页的数据相同
- ExtJS:为存储中的数据分配一个变量
- 嵌套的XML数据和ExtJS模型关联
- 如何忽略ExtJS数据模型中的空字段
- 在单元格编辑时获取extjs中的行数据
- ExtJS :: 存储加载数据方法优化
- 如何在extjs或jquery中显示JSON数据
- ExtJS v3 - 从表单面板内的网格面板访问数据
- 通过 id-Extjs 将数据加载到模型中
- ExtJS 4.2 将网格数据导出到可下载的 CSV 文件
- 数据绑定示例 extjs sencha
- JSON存储可以't加载PHP数据-EXTJS 4