Hello,
it seems the hierarchy-function only works the first time. If i click on the symbol for another node the controller action fires, data comes back, but for whatever reason the grid doesn't show the data in the grid.
I'm not quite sure why this doesn't work, but to me it seems like tha grid doesn't refresh itself.
View:
@using DAKCrmImport.Web.Models;
@{
ViewBag.Title = "Index";
}
<h2>Profilübersicht</h2>
@(Html.Kendo().Grid<CrmProfileGridVM>().Name("grid-crmprofiles").BindTo(Model).Columns(c =>
{
//<a class='button-action grid-details' onclick='showProfile(this)' title='Details'>button details</a>
c.Template(t => { }).HeaderTemplate("")
.ClientTemplate(@"
<a class='button grid-button button-details' title='Details' id='bt-profile-details'>button details</a>
<a class='button grid-button button-delete' onclick='' title='Löschen' id='bt-profile-delete'>button delete</a>
<a class='button grid-button button-edit' onclick='' title='Bearbeiten' id='bt-profile-edit'>button edit</a>
<a class='button grid-button button-create' onclick='' title='Job erstellen' id='bt-profile-createjob'>button create</a>").Width(250);
c.Bound(i => i.Name);
c.Bound(i => i.JobCount);
c.Bound(i => i.UserGroup);
c.Bound(i => i.CreatedBy);
c.Bound(i => i.CreatedAt);
c.Bound(i => i.LastUpdatedBy);
c.Bound(i => i.LastUpdatedAt);
})
.ToolBar(toolBar => toolBar.Template("<a href='javascript: void(0)' class='button button-create2' title='Neues Profil anlegen' id='bt-profile-create'>button create</a>"))
.HtmlAttributes(new { style = "height: 680px;" })
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Scrollable()
.ClientDetailTemplateId("template-grid-crmprofile")
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Model(model => model.Id(p => p.Id))
.Read(r => r.Action("Read", "CrmProfile"))
))
<script id="template-grid-crmprofile" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmJobGridVM>()
.Name("grid-crmjobs")
.Columns(c =>
{
c.Bound(j => j.CreatedBy);
c.Bound(j => j.JobStatus);
c.Bound(j => j.CreatedAt);
c.Bound(j => j.EndedAt);
c.Bound(j => j.CrmObjectCount);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetJobsByProfileId", "CrmJob", new { profileId = "#=Id#" }))
)
.ClientDetailTemplateId("template-grid-crmjob")
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
<script id="template-grid-crmjob" type="text/kendo-tmpl">
@(Html.Kendo().Grid<CrmObjectGridVM>()
.Name("grid-crmobjects")
.Columns(c =>
{
c.Template(t => { }).HeaderTemplate("").ClientTemplate("<a class='button grid-button button-details bt-object-details' title='Details'>button details</a>")
.Width(50);
c.Bound(o => o.OrdnungsbegriffTypString);
c.Bound(o => o.OrdnungsbegriffWert);
c.Bound(o => o.IsProcessedString);
c.Bound(o => o.Error);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(10)
.Read(r => r.Action("GetObjectsByJobId", "CrmObject", new { jobId = "#=Id#" }))
)
.Pageable()
.Sortable()
.HtmlAttributes(new { @class = "gr-crmobjects" })
.ToClientTemplate()
)
</script>
Controller-Action:
public virtual ActionResult GetJobsByProfileId(int profileId, [DataSourceRequest] DataSourceRequest request)
{
return Json(Mapper.Map<CrmJobGridVM[]>(db.GetJobsByProfileId(profileId)).ToDataSourceResult(request));
}
I'd really appreciate some help.