i have formula function "calculateTotal" which basically returns true if all checkboxes are ticked in the corresponding row, see an example here: http://jsfiddle.net/btwopc7f/
i want this function to fire every time any of the values change in the corresponding row, i.e. have a computed column watching for changes happening in the grid. is it possible with the unbound column?
ahh it actually does work by default, in my case i also have a custom editCellEnded and editCellStarted functions, which i guess is what breaks the default behaviour??
Hello G. Fawkes,
Thank you for posting in our forum.
By default the whole row is re-rendered after a row/cell was updated and editing has ended, which in turn will invoke any formatter/formula function for the related columns and apply the new result for the rendered cells.
Just attaching event handlers for the editCellStarted and editCellEnded events should not change the behavior.
Could you update your fiddle so that it more closely resembles your scenario? If that’s not possible could you share some code snippets of the code you have in the editCellStarted and editCellEnded functions?
I’m looking forward to your reply.
Best Regards,
Maya Kirova
Infragistics, Inc.
http://ko.infragistics.com/support
hi,
here's an updated example: http://jsfiddle.net/h0e0e8Lg/
i'm getting errors upon clicking on the unbound ("All") column. instead i want the onEditCellEnded event to fire.
The error is due to the data type returned from the formula method(number) not matching the column type (bool).
You can convert the numeric value back to Boolean, for example:
var res = Boolean(data["Exclude1"] * data["Exclude2"] * data["Exclude3"]);
Also I see that you edit directly the data source and call databind on each editCellEnded event.
This would re-render the grid each time you end editing for a cell ( which in this sample will happen each time you enter edit mode due to the “endEdit” Api call inside the editCellStarted event handler).
There’s no need to re-render the whole grid, you can instead use the setCellValue Api method and update the cells of the related row.
I’ve updated your fiddle for your reference:
http://jsfiddle.net/h0e0e8Lg/2/
Let me know if you have any questions.
The updating feature does not allow updating cells with a single click out of the box.
While the content of the cell looks like a checkbox it’s not an actual checkbox that can be edited directly. It still requires you to enter edit mode before the value can be updated.
As a workaround you can handle the updating manually. You could certainly use the approach of ending editing right after it has begun, however that would not allow you to edit any other type of column. If that’s not part of your requirement you can use that approach as demonstrated here:
http://jsfiddle.net/h0e0e8Lg/3/
Otherwise I would suggest making all checkbox columns read-only and manually handle the changing of the value on the cellClick event. In this way the checkbox behavior will not affect the default editing behavior of other columns.
You can refer to the example here:
http://jsfiddle.net/h0e0e8Lg/5/
I hope you’ll find this information useful. Let me know if you have any additional questions.
thanks, however the single-click update no longer works in your example