EditorGridPanel: Current value of cell
By mike | January 6, 2009
Using the beforeEdit event, I can get to the row/field that was being edited. However, I'm unable to get to the current value in the cell. Store.getModifiedRecords() only works once the user tabs out of the field (in which case I can also get it via afteredit).
How can I read the current dirty value in a cell using fieldName/colIndex & row?
Thanks
grid.preEditValue sounds like it could be what I'm looking for but using your code, it doesn't return anything while I'm sitting in the cell after having typed 50. I do get the correct field from grid.activeEditor.col.
Hopefully, this clarifies my use case better.
Thanks Condor
var recId, field, value;
ds.on({
beforeload: function() {
recId = null;
field = null;
value = null;
if (grid.activeEditor) {
recId = grid.activeEditor.record.data.Contract;
field = grid.colModel.getDataIndex(grid.activeEditor.col);
value = grid.activeEditor.getValue();
}
},
load: function() {
if (recId) {
var row = ds.findBy(function(r,i){
return recId == r.data.Contract;
});
var col = grid.colModel.findColumnIndex(field);
grid.startEditing(row, col);
(function() {
grid.activeEditor.field.setValue(value);
recId = null;
field = null;
value = null;
}).defer(50, this);
}
}
});
Thanks
grid.activeEditor is null
load()()MarketAc...rsion=1.0 (line 101)
fire()()ext-all-...rsion=1.0 (line 1488)
fireEvent()()ext-all-...rsion=1.0 (line 1184)
loadRecords()(Object success=true records=Object totalRecords=203, Object params=Object, true)ext-all-...rsion=1.0 (line 10858)
loadResponse()(Object params=Object request=Object reader=Object, true, Object tId=9 status=200 statusText=OK)ext-all-...rsion=1.0 (line 11342)
getViewWidth()(function(), Object events=Object conn=Object useAjax=true, Object 0=Object 1=true 2=Object, undefined)ext-base...rsion=1.0 (line 9)
handleResponse()(Object tId=9 status=200 statusText=OK)ext-all-...rsion=1.0 (line 5318)
getViewWidth()(Object conn=XMLHttpRequest tId=9, Object scope=Object argument=Object timeout=30000, undefined)ext-base...rsion=1.0 (line 10)
getViewWidth()()ext-base...rsion=1.0 (line 10)
grid.activeEditor.field.setValue(value);
var recId, field, value;
ds.on({
beforeload: function() {
recid = null;
field = null;
value = null;
if (grid.activeEditor) {
recId = grid.activeEditor.record.data.Contract;
field = grid.colModel.getDataIndex(grid.activeEditor.col);
value = grid.activeEditor.field.getValue();
}
},
load: function() {
if (recId) {
var row = ds.findBy(function(r,i){
return recId == r.data.Contract;
});
var col = grid.colModel.findColumnIndex(field);
grid.startEditing(row, col);
grid.activeEditor.field.setValue(value); // this is the error line
}
}
});
Are you looking for:
if (grid.activeEditor) {
var id = activeEditor.record.id;
var record = grid.store.getById(id);
var field = grid.colModel.getDataIndex(activeEditor.col);
var value = grid.preEditValue(record, field);
activeEditor.field.setValue(value);
}
Thanks
(function() {
grid.activeEditor.field.setValue(value);
}).defer(50, this);
var recid, field, value;
grid.store.on({
beforeload: {
if (grid.activeEditor) {
recid = grid.activeEditor.record.id;
field = grid.colModel.getDataIndex(activeEditor.col);
value = grid.activeEditor.field.getValue();
}
},
load: {
if (recid) {
var row = grid.store.indexOfId(recid);
var col = grid.colModel.findColumnIndex(field);
grid.startEditing(row, col);
grid.activeEditor.field.setValue(value);
}
}
});
#If you have any other info about this subject , Please add it free.# |
Topics: enart.xn--fiqs8sjn5by0n.com | edit
