In our grid we want to expand the detailview when the user selects a row.
Which works fine. The Selectable property of the grid is set to true and the selectmode to row. The onchange eventhandler is set to the function below
When the grid is clicked it handles the expansion or colapsing:
function kendoGridChange(e) {
var row = this.select();
if (row != null) {
if (row.next(".k-detail-row").is(":visible")) {
e.sender.collapseRow(row);
} else {
e.sender.expandRow(row);
}
}
}
This works fine.
But: when the user clicks the expand button itself the onchange event is also fired. Which leads to the expansion toggle. After that the default expansion behaviour is fired again. Which leads to a second toggle. Which results is no change.
We have tried in several ways to prevent this happening
- Examine the incoming event and its sender. There seems to be no way to find out which element was clicked. The expand button or another element in the grid.
- Fire preventdefault, stopPropagation, stopImmdeatePropagation and the like.
- Attach a clickhandler to the expand-button.
None of this has solved the issue. Anybody know a way out ?
It worked fine in the MVC grid.
Peter