There is a Kendo Ui Grid. I wanted to make it possible for each line to call a substring. watched how it is done here http://demos.telerik.com/kendo-ui/grid/hierarchy

Podgid do this:

function detailInit(e) { $("<div/>").appendTo(e.detailCell).kendoGrid({ dataSource: { transport: { read: { url: kendo.format("/Home/Metod"), dataType: "json", type: "POST", data: {name:"parameter"} } } }, columns: [ { field: "name", title: "name1", width: "50px" }, { field: "name2", title: "name2", width: "50px" } ], resizable: true }); } 

Called method in the controller that should return data for the subgrid:

 [HttpPost] public JsonResult findSchemasInfo(string name) { 

// .... form a collection of objects

  return new JsonResult() { Data = new { //Π²ΠΎΠ·Π²Ρ€Π°Ρ‰Π°Π΅ΠΌ ΠΊΠΎΠ»Π»Π΅ΠΊΡ†ΠΈΡŽ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ΠΎΠ² (список), Ρƒ ΠΊΠ°ΠΆΠ΄ΠΎΠ³ΠΎ ΠΈΠ· //ΠΊΠΎΡ‚ΠΎΡ€ΠΎΠ³ΠΎ 2 тСкстовых поля - name1 ΠΈ name2 }, }; } 

The next question is how to send a collection of objects from the controller and how to receive it in the js script (what is wrong with it)?

  • in Dojo fill in your code, so do not make out what the problem is - Mstislav Pavlov
  • I'm sorry, I don't know what Dojo is. Filled on the file exchanger - my-files.ru/wddon2 - Dmitry
  • dojo.telerik.com here dojo - Mstislav Pavlov
  • Mm, I do not quite understand how to fill in the code there. In addition, there is another method ASP controller MVC. It seems there can not be inserted the same. Perhaps there is some other way to explain what is not clearly explained in the question? - Dmitry
  • Well, you have a problem not in the MVC method, so you can omit it. As for the dojo, select the framework, your marking should be on the left and the script, then click Run, on the right you will see the result. - Mstislav Pavlov

1 answer 1

Judging by your code, you are not using kendo correctly - you are trying to create table headers using razor , while you just need to configure the table via js, specifying all the necessary parameters, such as table header, sorting, filters, data model, data source, etc. .

By the way, if you use C #, then you can use the ASP .NET implementation of the Kendo UI, as a beginner, it will be easier for you to use it. However, from my own experience, I note that js implementation is much more flexible.

Here is an example of a hierarchical table in ASP .NET taken from Telemer’s examples:

 @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>() .Name("grid") .Columns(columns => { columns.Bound(e => e.FirstName).Width(110); columns.Bound(e => e.LastName).Width(110); columns.Bound(e => e.Country).Width(110); columns.Bound(e => e.City).Width(110); columns.Bound(e => e.Title); }) .Sortable() .Pageable() .Scrollable() .ClientDetailTemplateId("template") .HtmlAttributes(new { style = "height:600px;" }) .DataSource(dataSource => dataSource .Ajax() .PageSize(6) .Read(read => read.Action("HierarchyBinding_Employees", "Grid")) ) .Events(events => events.DataBound("dataBound")) ) <script id="template" type="text/kendo-tmpl"> @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>() .Name("grid_#=EmployeeID#") // template expression, to be evaluated in the master context .Columns(columns => { columns.Bound(o => o.OrderID).Width(110); columns.Bound(o => o.ShipCountry).Width(110); columns.Bound(o => o.ShipAddress).ClientTemplate("\\#= ShipAddress \\#"); // escaped template expression, to be evaluated in the child/detail context columns.Bound(o => o.ShipName).Width(300); }) .DataSource(dataSource => dataSource .Ajax() .PageSize(10) .Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" })) ) .Pageable() .Sortable() .ToClientTemplate() ) </script> <script> function dataBound() { this.expandRow(this.tbody.find("tr.k-master-row").first()); } </script>