Custom No Records template

4 posts, 1 answers
  1. Perry
    Perry avatar
    26 posts
    Member since:
    Feb 2019

    Posted 04 Jun Link to this post

    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!'}"   

  2. Georgi
    Admin
    Georgi avatar
    576 posts

    Posted 06 Jun Link to this post

    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.
  3. Perry
    Perry avatar
    26 posts
    Member since:
    Feb 2019

    Posted 06 Jun in reply to Georgi Link to this post

    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) ;   
            },        

     

  4. Answer
    Georgi
    Admin
    Georgi avatar
    576 posts

    Posted 10 Jun Link to this post

    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.
Back to Top