如何使用来自另一个单元格的 onChange 事件更新一个单元格
How to update one cell using the onChange Event from another cell?
道场数据网格的简单模板如下,我正在为更复杂的东西构建它。
例如,如何根据同一行的字段 1 的 onChange 事件更新字段 2 的值?就像将字段 1 的值复制到字段 2 一样。问题是我没有特定单元格的 id,在布局下放置 on Change 或 addRow() 似乎都不对,并且似乎不能使用 onChange:function(){...}?
/*set up data store*/
var data = {
identifier: "id",
items: []
};
var store = new dojo.data.ItemFileWriteStore({data: data});
/*set up layout*/
var layout = [
defaultCell: {
editable: true,
type: dojox.grid.cells._Widget
}
rows: [
{name: 'ID', field: 'id', width: '30px', widgetClass: dijit.form.TextBox, editable: false},
{name: 'ColA', field: 'field1', width: '100px', widgetClass: dijit.form.TextBox},
{name: 'ColB', field: 'field2', width: '100px', widgetClass: dijit.form.TextBox}
]
];
/*create a new grid*/
var grid = new dojox.grid.DataGrid({
id: 'grid',
store: store,
structure: layout,
singleClickEdit: true,
rowSelector: '15px'});
/*append the new grid to the div*/
grid.placeAt("gridDiv");
/*Call startup() to render the grid*/
grid.startup();
function addRow(){
store.newItem({
id: grid.rowCount,
field1: '-',
field2: '-'});
grid.render();
}
尝试改用onApplyCellEditin(Value, inRowIndex, inFieldIndex)
。
相关文章:
- 传递单元格值以便使用ajax post更新表
- 在动态表格单元格跨度中单击时更新一个权重值
- 更新单元格矩阵中的数据
- 如何在更改一列时更新HTML表行中的单元格
- 剑道UI网格更新仅更改了单元格/列
- JQuery 更新表单元格并添加新的表行
- jQuery 更改单元格类并更新数据
- Jquery 数据表更新单元格文本值和颜色
- 更新其中一个数据表单元格的多个下拉值的最佳方法是什么
- 如何使用来自另一个单元格的 onChange 事件更新一个单元格
- 具有特定单元格数据更新的实时网格(JavaScript/jQuery)
- PHP更新单元格数据错误
- jquery搜索表单元格->更新相邻小区
- 如何使用jquery更新HTML表格单元格
- 更新Handontable中的特定单元格
- 添加新的行实例,无法更新单元格原始值
- 剑道-在选择网格单元格时更新另一个网格(mvvm)
- 对表单元格的Ng-change更新所有单元格
- Ext JS 4: GridPanel -基于更新的单元格更新列单元格值
- HTML/JS从另一个表单元格更新一个表单元