EDIT: This was happening because the cell sometimes contained a DIV, and the DIV, not the TD, was the event target, which messed up the code that gets the cell-index.
IIt may be my error, or it could be a problem with the grid or jQuery. My code is shown below. I'm clicking on the same column, choosing a different row at random, and every so often, the wrong column-index is returned. I cannot figure out why it works most of the time, but not always. I'm clicking on a column whose index is 7. Sometimes zero is returned.
IIt may be my error, or it could be a problem with the grid or jQuery. My code is shown below. I'm clicking on the same column, choosing a different row at random, and every so often, the wrong column-index is returned. I cannot figure out why it works most of the time, but not always. I'm clicking on a column whose index is 7. Sometimes zero is returned.
function addCellClickEventListener() { var grid = $('#grid').data('kendoGrid'); $(grid.tbody).on('click', "> tr:not(.k-grouping-row, .k-detail-row, .k-group-footer) ", function (e) { popup(e); }); }function popup(e) { var cell = e.target; var ix = $(cell).index(); assert((ix != 0), "index must be greater than zero"); }function assert(val, msg) { if (!val) { alert(msg); return false;
} return true;}