Note that there are some explanatory texts on larger screens.

plurals
  1. POInteracting with Kendo Ui Child Grid
    text
    copied!<p>I'm currently using the MVC Kendo Grid with Hierarchy view to display child accounts. Here is my main grid (child below) For this grid I have set up the change event (also below). My question is, how do I set up the same change functionality with the child grid? Each will have a different ID so I'm not currently able to properly select it. EDIT: <strong>I ONLY NEED THE ID OF THE ACCOUNT FROM THE SELECTED CHILD ROW</strong></p> <pre><code> @(Html.Kendo().Grid&lt;TRX.CRM.Dashboard.Entities.DashBoard.Accounts&gt;() .Name("Grid") .Columns(columns =&gt; { columns.Bound(p =&gt; p.Acct_FName).Width(80); columns.Bound(p =&gt; p.Acct_LName).Width(80); columns.Bound(p =&gt; p.Acct_Type).Width(90); columns.Bound(p =&gt; p.Acct_LastContact).Width(140); columns.Bound(p =&gt; p.Acct_Zip).Hidden(); columns.Bound(p =&gt; p.ID).Hidden(); }) .ClientDetailTemplateId("ChildAccounts") .DataSource(dataSource =&gt; dataSource .Ajax() // Specify that the data source is of ajax type .Model(model =&gt; model.Id(a =&gt; a.ID)) .Events(events =&gt; events.Error("error")) .Read(read =&gt; read.Action("ReadAccounts", "Accounts")) // Specify the action method and controller name .Destroy(destroy =&gt; destroy.Action("DeleteAccount", "Accounts")) .PageSize(50) ) .Pageable() .Filterable() .Selectable() .Scrollable() .Sortable() .Events(events =&gt; events.Change("gridChange")) .Events(events =&gt; events.DataBound("dataBound")) .ToolBar(toolbar =&gt; toolbar.Template( @&lt;text&gt; &lt;div class="toolbar"&gt; &lt;select id="FilterCategory"&gt;&lt;/select&gt; &lt;input type="search" id="Search" style="width: 230px" /&gt; &lt;/div&gt; &lt;/text&gt; )) ) </code></pre> <p>Child Grid:</p> <pre><code> &lt;script id="ChildAccounts" type="text/kendo-tmpl"&gt; @(Html.Kendo().Grid&lt;TRX.CRM.Dashboard.Entities.DashBoard.Accounts&gt;() .Name("SubAccounts_#=ID#") .Columns(columns =&gt; { columns.Bound(p =&gt; p.Acct_FName).Width(80); columns.Bound(p =&gt; p.Acct_LName).Width(80); columns.Bound(p =&gt; p.Acct_Type).Width(90); columns.Bound(p =&gt; p.Acct_LastContact).Width(140); columns.Bound(p =&gt; p.Acct_Zip).Hidden(); columns.Bound(p =&gt; p.ID).Hidden(); }) .DataSource(dataSource =&gt; dataSource .Ajax() .Read(read =&gt; read.Action("ReadSubAccounts", "Accounts", new { ID = "#=ID#" })) ) .Pageable() .Sortable() .Selectable() .ToClientTemplate() ) &lt;/script&gt; function dataBound() { // this.expandRow(this.tbody.find("tr.k-master-row").first()); } </code></pre> <p>Here is the GridChange function (shortened for brevity)</p> <pre><code>function gridChange(e) { //Enable all button -Prakash Date-07/27/2012 accountsButtons.button({ disabled: false }); $("#nodeList").html(''); $("#updateMessage").html(''); $("#noteMessage").html(''); $("#Note_Description").val(''); kdata = this; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload