This is a migrated thread and some comments may be shown as answers.

Custom No Records template

3 Answers 293 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Perry
Top achievements
Rank 1
Perry asked on 04 Jun 2019, 09:40 PM

On a grid is it possible to display an error message from the viewmodel datasource in the no records template?

I know you can display a custom string like this.

data-no-records="{ template: 'No Records Today!'}"   

3 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 06 Jun 2019, 01:02 PM
Hello Perry,

A possible solution would be to insert the error message to the no records element within the error event handler of the dataSource.

e.g.

onError: function (e){
 $('.k-grid-norecords-template').html(e.message)
 
}


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Perry
Top achievements
Rank 1
answered on 06 Jun 2019, 06:10 PM

Cool Thanks,

I think it's actually the 'error' event (at least in my case it is)

 error: function (xhr, error) {            
            $('.k-grid-norecords-template').html( xhr.xhr.status + ' ' + xhr.xhr.statusText) ;   
        },        

 

0
Accepted
Georgi
Telerik team
answered on 10 Jun 2019, 09:27 AM
Hello Perry,

My bad, it's a typo. Indeed the event is called `error`.

e.g.

error: function (xhr, error) { 
 ...


Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
MVVM
Asked by
Perry
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Perry
Top achievements
Rank 1
Share this question
or