Thank you in advance for any feedback!
I am attaching some sample code where I am binding data with grid; then setting the groupable option to true. When I intend to use the group column two things happens. One it displays the field name and not the title name, and the most important part it returns nothing.
Rocio
7 Answers, 1 is accepted
Based on the provided information, I suspect the Grid is initialized two times - once via kendo.bind() and once programmatically via kendoGrid(). The second initialization removes the dataSource settings, or at least I do not see them in the code. As a result, grouping cannot occur, as there is no information where to get the data from.
Duplicate initialization is not allowed:
http://docs.telerik.com/kendo-ui/intro/installation/jquery-initialization#duplicate-initialization
If your scenario is different, please elaborate and even better, send a runnable example.
Regards,
Dimo
Telerik by Progress
Thank you for your reply. You are correct, I was initializing two times the grid and that was causing the problem. In addition, I was defining a table and then binding the grid to the table which may have been part of the problem too. I followed your directions, and only bind it to a div; and not it works.
Hi Dimo,
I have similar problem in Telerik grid.
If i didn't write DataBinding and EnableCustomBinding, groupable is working. If i write DataBinding and EnableCustomBinding(true) then the data it is showing blank. But it is fetching from the back end.
What is the problem.
I'm afraid that the provided information is not sufficient. Could you please elaborate on the scenario and provide as much as possible of the following:
- the grid and data source configurations
- a runnable demo to illustrate your case
- step by step instructions to reproduce it
Look forward to your response.
Kind Regards,
Alex Hajigeorgieva
Progress Telerik
Hi Alex,
Thanks for the reply. I will try to explain my problem what ever i am facing. We were using telerik.
Very first i am calling the below Action i.e Vendors. At that time the grid is populating with out any issue. For example you can find the first attachment.
[HttpGet]
public ActionResult Vendors(int? id)
{
ViewBag.TotalRows = 0;
try
{
GridMetaData gridMetaData = new GridMetaData();
gridMetaData.PageSize = 20;
List<PurchaseVendorViewModel> list = CommonSrv.GetVendors(gridMetaData, LoggedInUserId, searchText, ContextMainTabId);
ViewBag.TotalRows = list.Count > 0 ? list[0].TotalRows : 0;
return View("~/Views/Common/Vendor/Vendors.cshtml", list);
}
}
catch (Exception ex)
{
throw ex;
}
}
After that if we don't use EnableCustomBinding and DataBinding then Grouping is working fine without any issue. If we use EnableCustomBinding and DataBinding then it is showing as in the second attachment.
Please find the telerik grid code in the 3rd image.
DataBinding action is Vendors. Please find the code regarding DataBinding in the 4th attachment.
Regards,
Vinay Kumar
Thank you for the provided screenshots.
Firstly, can you confirm that you are using the latest Kendo UI version? The DataKeys configuration was moved to the DataSource model five years ago:
http://docs.telerik.com/aspnet-mvc/migration/widgets/grid#datakeys
And the same goes for the DataBinding configuration:
http://docs.telerik.com/aspnet-mvc/migration/widgets/grid#data-binding
What is the preferred way of binding the Kendo UI Grid? It looks like server binding - note how the model is passed to the grid HTML helper:
@model IEnumerable<
Kendo.Mvc.Examples.Models.Product
>
@(Html.Kendo().Grid(Model)
.Name("Grid")
http://demos.telerik.com/aspnet-mvc/grid/serveraggregates
If you wish to enable custom server binding, then check the demo here:
http://demos.telerik.com/aspnet-mvc/grid/customserverbinding
@(Html.Kendo().Grid<
Kendo.Mvc.Examples.Models.Order
>()
Kind Regards,
Alex Hajigeorgieva
Progress Telerik