MVC Kendo Grid SORT is not working, Please help

1 Answer 61 Views
Grid Sortable
Ravikanth
Top achievements
Rank 1
Ravikanth asked on 13 Jun 2024, 06:05 PM

Please see the code i have and sorting is not working and If I server operation to false then data is not loading

 

-------------------------------

                @(Html.Kendo().Grid<LifeLabs.FIT.Web.RequisitionFileViewModel>()
                                                                        .Name("problemQueue-no-followups-grid")
                                                                        .EnableCustomBinding(true)
                                                                        .Columns(columns =>
                                                                        {
                                                                            columns.Bound(c => c.OrderId).Hidden();
                                                                            columns.Bound(c => c.FormatedOrderCode).Title("Order Code").Width(85);
                                                                            columns.Bound(c => c.AccessionNumber).Title("Accession#").Width(85);
                                                                            columns.Bound(c => c.Physician).Title("Requester Name").Width(110).Sortable(true);
                                                                            columns.Bound(c => c.CreatedOn).ClientTemplate("#= moment(CreatedOn).add(moment().utcOffset(), 'minutes').format('YYYY/MM/DD HH:mm:ss') #").Width(110);
                                                                            columns.Bound(c => c.UpdatedOn).ClientTemplate("#= moment(UpdatedOn).add(moment().utcOffset(), 'minutes').format('YYYY/MM/DD HH:mm:ss') #").Title("Moved to Queue").Width(110);
                                                                            columns.Bound(c => c.Status)
                                                                            .ClientTemplate("#if(IsLocked){#<div>#=Status#</div>#}else{if(isLongTermFollowUp==1){#<div style='background-color:red'><a href='/Order/EditRequisition?id=+#=OrderId#&Queue=3'>#=Status#</a></div>#}    else{#<div><a href='/Order/EditRequisition?id=+#=OrderId#&Queue=3'>#=Status#</a></div>#}}#").Width(65);
                                                                            columns.Bound(c => c.IsLocked).Title("Locked").Width(50)
                                                                            .ClientTemplate("#if(IsLocked){#<div><i class='fa fa-check'></i></div>#}else{#<div></div>#}#");
                                                                            columns.Bound(c => c.UserNote).Title("Notes").Sortable(true).Width(200);
                                                                            //columns.Bound(c => c.isLongTermFollowUp).Title("Long Term F/U").Width(125)
                                                                            //.ClientTemplate("#if(isLongTermFollowUp){#<div><i class='fa fa-check'></i></div>#}else{#<div></div>#}#");
                                                                        })
                                                                        //.ClientRowTemplate("#if(isLongTermFollowUp==1) {#<tr style='background-color:red' data-uid='#= uid #'></tr>#}")
                                                                        .HtmlAttributes(new { style = "height: 430px;" })
                                                                        .Scrollable()
                                                                        .Sortable(sorting => sorting.Enabled(true))
                                                                        .Pageable(pageable => pageable
                                                                        .Refresh(true)
                                                                        .PageSizes(true)
                                                                        .ButtonCount(5))
                                                                        .DataSource(dataSource => dataSource
                                                                        .Ajax()
                                                                        .Read(read => read.Action("GetProblemQueueList", "ProblemQueue", new { type = "no" }))
                                                                        .ServerOperation(true)
                                                                        )
                )

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 18 Jun 2024, 03:08 PM

Hi Ravikanth,

I noticed that there is no license associated with your account. Be advised, that this limits our support service overall. In order to have a grasp of the support service, I would strongly advocate reviewing our available support plans:

Rest assured, I want to help as best as I can during your embarked endeavors, thus, I suppose that the issue may be caused by the employed server-side operation that handles the fetching of data. As I did not find anything evident within the Grid's configuration that would cause the reported behavior.

Be advised, that when configured for remote binding operations, the Grid conforms to specific rules. Namely, by introducing the DataSourceRequest and DataSourceResult abstractions.

Which operates in the following manner:

Taking this a step further, here is how the raw code implementation would potentially look like:

public class ProblemQueueController : Controller
{
    public ActionResult GetProblemQueueList([DataSourceRequest] DataSourceRequest request) // DataSourceRequest contains the composed filtering, sorting, grouping, paging, andd aggregation expressions.
    {
        var data = Enumerable.Range(1, 10)
            .Select(i => new RequisitionFileViewModel
            {
               ...
            })
            .ToList();

        return Json(data.ToDataSourceResult(request)); // The ToDataSourceResult() method accomodates the data in a format that will be consumed on the client-side.
    }
}

Could you please confirm whether there is no deviation between the declaration of the server side on the endpoint? And the one demonstrated in the aforementioned snippet.

Kind Regards,
Alexander
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Tags
Grid Sortable
Asked by
Ravikanth
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or