Telerik MVC hierarchy grid, editor popup, get parent data in JavaScript event -
i've been doing lot of searching, , can't seem find examples work.
i simplify code here have large telerik mvc hierarchy grid. here's child template few levels down, need parent information previous level.
<script id="leaguetemplate" type="text/kendo-tmpl"> @(html.kendo().grid<leagueviewmodel>() .name("grid_#=leaguetypeid#") .toolbar(toolbar => { toolbar.create().text("add new league(window)"); }) .events(e => e.edit("leagueedit")) // function runs .datasource(datasource => datasource .ajax() .model(model => model.id(p => p.leagueid)) .read(read => read.action("bound_league_read", "configuration", new { _leaguetypeid = "#=leaguetypeid#" })) .create(create => create.action("league_create", "configuration").data("getheirarchydata")) // function doesnt run ) ) </script> function getheirarchydata() { console.log("get heirachy data"); // never runs } function leagueedit(e) { // runs // not sure how parent data e }
there might better way solve this, , if i'll check answer maybe in meantime.
i solved setting default values model works excellent except string values because of way have access values template syntax strings. added string value equivalents hierarchy fields model.
.model(model => { model.id(p => p.leagueid); model.field(l => l.strsportid).defaultvalue("#=sportid#"); model.field(l => l.strleaguetypeid).defaultvalue("#=leaguetypeid#"); } )
then when called edit function, values this:
function leagueedit(e) { var sportid = parseint(e.model.strsportid); var leaguetypeid = parseint(e.model.strleaguetypeid); }
Comments
Post a Comment