Display custom / model errors

2 posts, 0 answers
  1. Ricky
    Ricky avatar
    18 posts
    Member since:
    Aug 2016

    Posted 14 Apr 2017 Link to this post

    Hello,

    I was wondering if there is some kind of automatic display of custom or model errors. To check this out, I created an example in the dojo.

    When the returned data contains the property defined as errors within the model, the error callback is called. But I would have expect that it creates an error message within the Grid like it does with No records available (but maybe in red). Instead the grid remains empty, neither displaying the custom error nor saying No records available.

    Is there a way to enable displaying custom errors within the Grid itself like the No records available message? Or will I have to push some DOM elements there by myself in the error function? If the later, is there an event which is called when no model/custom error is there anymore so I know when to remove my DOM elements showing the error?

    For short reference here the last grid example from my dojo which just creates an empty grid:

    01.$('#grid3').kendoGrid({
    02.  columns: [{field: 'name'},{field: 'age'}],
    03.  dataSource: new kendo.data.DataSource({
    04.    data: { apiError: ['Server is under maintainance!'] },
    05.    schema: { errors: 'apiError' },
    06.    error: function(e) {
    07.      console.error('grid error:', e);
    08.    },
    09.  }),
    10.  noRecords: true,
    11.});
  2. Stefan
    Admin
    Stefan avatar
    2834 posts

    Posted 18 Apr 2017 Link to this post

    Hello Ricky,

    Unfortunately, the Grid support only no data custom messages.

    In this scenario, the error handling and displaying the message to the user have to be done manually.

    I can suggest a couple of events which can be used to remove the DOM element if the data is available and the request is successful:

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#events-requestEnd

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-dataBinding

    Also, I can suggest submitting a feature request for the desired functionality and based on its popularity we may implement it in a future release:

    http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback/category/170280-grid


    Regards,
    Stefan
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top