Thursday, October 15, 2015

Sort a kendo grid from razor configuration

Simple, add sort instructions to the data source:

     .DataSource(data => data.Ajax()  
                     .Model(model =>  
                     {  
                       model.Id(record => record.doseID);  
                       model.Field(m => m.drugID).DefaultValue(23);  
                     })  
             .Read(read => read.Action("GetPatientDoses", "PHMedications", new { id = @queryValue, drug = 23, isIV = false, isSQ = false }))  
             .Create(create => create.Action("DoseCreate", "PHMedications").Data("GetqueryValue"))  
             .Update(update => update.Action("DoseUpdate", "PHMedications"))  
             .Destroy(delete => delete.Action("DoseDelete", "PHMedications"))  
             .Sort(m =>  
             {  
               m.Add("doseEndDate").Ascending();  
               m.Add("doseStartDate").Descending();  
             })  
             .PageSize(2)  

No comments:

Post a Comment