1

Difficulty reading value of checkBoxes in Kendo grid. The case Adding bindeable checkbox column to grid is solved by OnaBai and works for Chrome, and OnaBai have made this example: : http://jsbin.com/ebadaj/12/edit. But in Internet Explorer (at least) 8 and 9, the event fires only once, after that the values are not updated. Any ideas?

Community
  • 1
  • 1
Olav Dahle
  • 21
  • 5

1 Answers1

1

Found a hack that seems to work. If MSIE, then recreate change event each time a checkbox in grid is clicked. See the original case for the rest of the code.

    model.vesselGrid.tbody.on("change", ".ob-paid", function (e) {
        onChange(e);
    });

    function onChange(e) {
        system.log("click");
        var row = $(e.target).closest("tr");
        var item = model.vesselGrid.dataItem(row);
        var ck = $(e.target).is(":checked") ? 1 : 0;

        item.set("IsSelected", ck);
        var brwsr = getBrowser();
        if (brwsr == "MSIE") {
            model.vesselGrid.tbody.on("change", ".ob-paid", function (ee) {
                onChange(ee);
            });
        }
    }

    //http://stackoverflow.com/questions/5916900/detect-version-of-browser
    function getBrowser() {
        var N = navigator.appName, ua = navigator.userAgent, tem;
        var M = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
        if (M && (tem = ua.match(/version\/([\.\d]+)/i)) != null) M[2] = tem[1];
        M = M ? [M[1], M[2]] : [N, navigator.appVersion, '-?'];
        return M[0];
    }
Olav Dahle
  • 21
  • 5