Apr 07, 2009, 8:03 PM
Example: Updating a Grid Cell programatically
hi,
very happy with coolite. Lets grow the sample code base.
Lets say you have a grid and on each row (record) there is a field (cell) that represents the sum total of a few of the other cells. We'll call that field total. Here is an easy way to do it.
Add a Listener to your grid:
very happy with coolite. Lets grow the sample code base.
Lets say you have a grid and on each row (record) there is a field (cell) that represents the sum total of a few of the other cells. We'll call that field total. Here is an easy way to do it.
Add a Listener to your grid:
<Listeners>
<ValidateEdit Fn="calcTlt" />
</Listeners>
On each row click you are going to get an event back with the EventArgObject.var calcTlt = function(e) {
var val = parseFloat(e.value); // this is the value of the current changed field ...
var valOfTlt = parseFloat(e.record.get('Tlt')); // Tlt is the name of the field i want to update
var setTo = valOfTlt + val;
e.record.set('Tlt', setTo);
};