Editing fields without sending them to server

2 posts, 0 answers
  1. Miguel
    Miguel avatar
    22 posts
    Member since:
    Oct 2013

    Posted 01 Dec 2017 Link to this post

    Hi! So I have this grid, that is a normal grid with create/update buttons and popup editing, that has a bunch of fields.

    Besides these fields, there are two fields that are just for helping the user. One is a count of objects related to that row in the database for instance.

    The thing is that I have a separate popup that lets me add more of these related objects, and I'd like that if I accepted the changes in that popup, the related object counter in the grid gets refreshed, for the entity that was changed only, instead of reloading all the grid's data.

    Before I had editing in the grid, I simply did it by setting the count as an editable field, and setting it after editing the related objects. Since it was editable, a 'model.set("Counter", counter + 1)' refreshed the grid's HTML just fine automatically.

    Now the issue is that I introducing popup editing to that grid. So now if I do "model.set(anything)", the DataSource of that grid marks the row as modified, and gets sent to the server in any sync call, or even more annoying, the counter change gets undone if I edit the row and cancel the changes in the popup editor, even if I didn't touch anything.

    Is there any way to do these sort of fields that refresh the grid's HTML on change, but that aren't part of the whole DataSource<->server cycle? I'd like the DataSource to ignore the change more or less, but have the grid's cell automatically updated in the DOM.

  2. Stefan
    Admin
    Stefan avatar
    2475 posts

    Posted 05 Dec 2017 Link to this post

    Hello, Miguel,

    Thank you for the description.

    Based on that I can assume that there is a Grid with a column(counter') that can change its values depending on interaction with another popup. This counter is not part of the Grid actual dataSource and any changes made to that column should not cause marking the model of the Grid as dirty.

    If this is correct, it could be achieved by programmatically changing the value of the "td" element of the Grid without making changes to the model, as every change in the model will cause marking the row as dirty.

    Also programmatically changing the value of the counter and calling the refresh of the Grid to re-render the new not-bound column.

    http://dojo.telerik.com/OnUTUt

    As the scenario is a specific one, please use the Dojo as a reference to demonstrate the desired result if additional assistance is needed.

    Regards,
    Stefan
    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