Kendo grid update dateitem dynamically - Javascript

4 posts, 0 answers
  1. Michael
    Michael avatar
    26 posts
    Member since:
    Jun 2015

    Posted 11 Dec 2017 Link to this post

    I have a grid with columns name, status and updatedAt. Status column as editable and has dropdown values. When a user update status value, I have called the rest api for doing some business logic and returns response with an updated date. I want to update that date in updatedAt column.

    Please help me to achieve this.

  2. Preslav
    Admin
    Preslav avatar
    516 posts

    Posted 12 Dec 2017 Link to this post

    Hello Michael,

    To achieve the desired behavior handle the save event of the Grid. In the event handler, use the model set method to assign the new value to the desired field.
    For example, check my testing Dojo:
    I hope the above helps. Please let me know if it works for you or we should look for another solution.


    Regards,
    Preslav
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Michael
    Michael avatar
    26 posts
    Member since:
    Jun 2015

    Posted 12 Dec 2017 in reply to Preslav Link to this post

    The answer looks good and working as expected. I have one more question, I know uid of dataitem and wants to update dataitem when click external button.

     

  4. Preslav
    Admin
    Preslav avatar
    516 posts

    Posted 13 Dec 2017 Link to this post

    Hello Michael,

    To update an item when clicking an external button and you know the UID of a row:
    1. Select the row in the Grid with jQuery

      $("[data-uid="+myUIDvar+"]")
    2. Pass the row as a parameter of the dataItem method.
      https://docs.telerik.com/kendo-ui/api/javascript/ui/grid#methods-dataItem
    3. Set the desired values.

    Please, check the above approach and let me know if it works for you.


    Regards,
    Preslav
    Progress Telerik
    Try our brand new, jQuery-free Angular 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