When are custom stat shorcuts updated?

I’m trying to implement a custom stat count shortcut that counts the total rows with a checked checkbox in a column.
Currently I have:

        mygrid._in_header_stat_count_checked = function(tag, col_idx, c){
            var count_checked = function() {
                var count = 0;
                var num_rows = this.getRowsNum();
                for (var i=0; i<num_rows; i++) {
                    var val = this.cellByIndex(i, col_idx).getValue();
                    if (val != '0') {
                return count;
            this._stat_in_header(tag, count_checked, col_idx, c);

Which correctly totals the checked boxes on the first load of the grid. However, when I check or uncheck a checkbox the total is not updated. How do I tell the stat count to update when the value of the any checkbox in that column is changed?


Please, try to add the following code to the init of your grid:

mygrid.attachEvent("onCheck", function(rId,cInd,state){ mygrid.callEvent("onGridReconstructed",[]); });