This question is locked. New answers and comments are not allowed.
Hi all,
I am trying to understand the binding order process and how values are being passed.
If you look at the source code: http://demos.telerik.com/aspnet-mvc/razor/grid/selectionclientside?theme=vista
you will see in the line below that we are passing a parameter as "new":
.DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectionClientSide_Orders", "Grid", new { customerID = "ALFKI" }))
but we also have the following line: e.data = $.extend(e.data, { customerID: customerID });
Some situations if I remove the "new { customerID = "ALFKI" }", the parameter is still passed, and sometimes I get a null.
I am trying to understand when that is necessary. What is the co-relation between that "new" parameter with the Javascript call $.extend?
Code sample which I am refering to:
Thank you!
I am trying to understand the binding order process and how values are being passed.
If you look at the source code: http://demos.telerik.com/aspnet-mvc/razor/grid/selectionclientside?theme=vista
you will see in the line below that we are passing a parameter as "new":
.DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectionClientSide_Orders", "Grid", new { customerID = "ALFKI" }))
but we also have the following line: e.data = $.extend(e.data, { customerID: customerID });
Some situations if I remove the "new { customerID = "ALFKI" }", the parameter is still passed, and sometimes I get a null.
I am trying to understand when that is necessary. What is the co-relation between that "new" parameter with the Javascript call $.extend?
Code sample which I am refering to:
@(Html.Telerik().Grid((IEnumerable<Order>)ViewData["Orders"]) .Name("Orders") .Columns(columns=> { columns.Bound(c => c.OrderID).Width(100); columns.Bound(c => c.OrderDate).Width(200).Format("{0:dd/MM/yyyy}"); columns.Bound(c => c.ShipAddress); columns.Bound(c => c.ShipCity).Width(200); }) .DataBinding(dataBinding => dataBinding.Ajax().Select("_SelectionClientSide_Orders", "Grid", new { customerID = "ALFKI" })) .ClientEvents(clientEvents => clientEvents.OnDataBinding("onDataBinding")) .Pageable() //.Pageable(paging => paging.PageSize(3)) .Sortable())<script type="text/javascript"> var customerID; function onRowSelected(e) { var ordersGrid = $('#Orders').data('tGrid'); customerID = e.row.cells[0].innerHTML; // update ui text $('#customerID').text(customerID); // rebind the related grid ordersGrid.rebind(); } function onDataBinding(e) { e.data = $.extend(e.data, { customerID: customerID }); }</script>Thank you!