asp.net - Get first cell data in child grid of kendo hierachy grid -
i m using kendo hierarchy grid. in child grid put "edit" button. need child row first column data (id) when click edit button.
my detailinit function , clickbfunction here.
function detailinit(e) { var _po_sectionid =e.data.sectionid; $("<div/>").appendto(e.detailcell).kendogrid({ datasource: { transport: { read: _postionsbysectionurl + _po_sectionid }, schema: { data: "data", total: "count" }, }, scrollable: false, sortable: true, pageable: true, { field: "containerid", title: "possition id",hidden:true }, { field: "containername", title: "containername",hidden:true }, { title: "action", width: 95, command: [ { id: "edit", name: "edit", click: onpositionrowselect, template: "<a class='k-button k-grid-edit' href='' style='min-width:16px;'><span class='k-icon k-edit'></span></a>" } ]}, ] }); }
how can child first row cell data onpositionrowselect function?
function onpositionrowselect(e) { e.preventdefault(); _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ alert("container id : "+ containerid); }
you can using closest() function. (http://www.kendoui.com/forums/kendo-ui-web/grid/how-to-get-first-cell-data-in-child-grid-of-hierachy-grid.aspx#bojszk6ag2of1p8aaftdxq)
function onpositionrowselect(e) { e.preventdefault(); var element = $(e.target); var grid = element.closest("[data-role=grid]").data("kendogrid"); var dataitem = grid.dataitem(element.closest("tr")); alert(dataitem.containerid); }
Comments
Post a Comment