javascript – 在单元格编辑中获取extjs中的行数据
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了javascript – 在单元格编辑中获取extjs中的行数据,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2978字,纯文字阅读大概需要5分钟。
内容图文
![javascript – 在单元格编辑中获取extjs中的行数据](/upload/InfoBanner/zyjiaocheng/721/7767b2c6f4d04712aba103c0ea79a048.jpg)
我正在创建一个Extjs网格.其中大部分列都是可编辑的.我需要的是,如果用户更改模糊的任何列值,我将调用我的方法根据其他列值进行一些计算.并将列值替换为计算值.code在这里.
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())
}
但它不会来.我必须根据原始tax.surcharge和cess计算价值所以我需要我的方法中的所有价值.如果这样做任何一个请帮助
解决方法:
CellEditing插件有一个可以监听的beforeedit事件:
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.plugin.CellEditing-event-beforeedit
这将使您可以访问以下内容:
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.
内容总结
以上是互联网集市为您收集整理的javascript – 在单元格编辑中获取extjs中的行数据全部内容,希望文章能够帮你解决javascript – 在单元格编辑中获取extjs中的行数据所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。