Kendo Grid Hierarchy Custom Edit Command

Sewaktu memanggil tombol edit di level 2 Kendo Grid hierarchy terdapat masalah. Entah mengapa, tombol edit di level 1 juga dipanggil, sehingga redirect menjadi tidak valid.

Capture

Klik edit PLN malah redirect ke edit Pembelian LNG.

Solusi saat ini memisahkan fungsi edit di level 1 dan level 2, dan memberikan variabel flag supaya edit di level 1 tidak dieksekusi.

[code language=”javascript”]
function editItem(e) {
e.preventDefault();
var data = this.dataItem(getDataRowGrid(e));
if (!lv2Clicked)
window.location.href = "@Url.Action("Edit")" + "?id=" + data.Id;
}

function editItem1(e) {
e.preventDefault();
var data = this.dataItem(getDataRowGrid(e));
lv2Clicked = true;
window.location.href = "@Url.Action("Edit")" + "?id=" + data.Id;
}
[/code]

Chandra Oemaryadi has written 244 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>