Telerik MVC grid - How to change “no post message” between ajax cals

I am using Telerik MVC grid ajax binding to display some records. While the grid is loaded, the message in the grid "No records found". When ajax cal is complete, then the message goes and the data is loaded. But this “No Records Found” message before loading the data confuses the user.

Can someone tell me how to change this post as "Loading ..." before the completion of ajax cal.

Thanks.

+4
source share
4 answers

Instead of using NoRecordsTemplate, I suggest the following:

  • Add clientevent to your grid: .ClientEvents (events => events.OnLoad ("Grid_onLoad"))
  • Add javascript function: function Grid_onLoad (e) {$ ('. T-no-data td'). text ('Download'); }

That way, if there are no records, the grid will still display “No records”, but the user will see a “Download” message during an ajax call.

+1
source

Search for the t-no-data class in your grid. Sort of

 $('#ReportGrid').find('.t-no-data td').text('Loading...'); 

should go in your onLoad() grid

+7
source

IMO by adding ".NoRecordsTemplate (" Loading ... ")" to make better use of the grid.

  @(Html.Telerik().Grid<RatingListItem>() .Name("Rating_Index_List") .Columns(columns => { columns.Bound(o => o.Id).Hidden(); columns.Bound(o => o.Score) }) .DataBinding(dataBinding => dataBinding.Ajax().Select(Model.ListPageGridModel.DataRequestAction.ActionName, Model.ListPageGridModel.DataRequestAction.ControllerName)) .Pageable(settings => settings.Total(Model.ListPageGridModel.TotalRow)) .EnableCustomBinding(true) .Sortable() .NoRecordsTemplate("Loading...") ) 
+3
source

You can use .NoRecordsTemplate for load times with the OnDataBound event to indicate when there are no records.

  @Html.Telerik().Grid<ViewModel>().Name("Temp") .NoRecordsTemplate("Loading ... Please Wait") .ClientEvents(e => e.OnDataBound("onDataBound")) 

Script Code

 function onDataBound() { $("tr.t-no-data td").html("No records to display"); } 
0
source

Source: https://habr.com/ru/post/1338412/


All Articles