EDIT: It's happening because the TD sometimes contains a DIV and the DIV, not the TD, becomes the target of the click event.
I posted this by accident in Window sub-forum.
It 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.
Also tried the following; cellindex and index() are not always in agreement.
function popup(e) {
cell = e.target;
var ix = $(cell).index();
var ix2 = $(cell)[0].cellIndex;
assert((ix == ix2), "index() and cellindex returning different values!");
}
I posted this by accident in Window sub-forum.
It 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.
Also tried the following; cellindex and index() are not always in agreement.
function popup(e) {
cell = e.target;
var ix = $(cell).index();
var ix2 = $(cell)[0].cellIndex;
assert((ix == ix2), "index() and cellindex returning different values!");
}
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;}