Manually Updating Multiple Values

7 posts, 0 answers
  1. Pete
    Pete avatar
    1 posts
    Member since:
    Nov 2014

    Posted 18 Dec 2014 Link to this post

    Hi,

    I have a requirement to update all selected rows with given value.  The grid is using the multi select mode and the column I am updating has a name of "status" e.g.

    <td name="status" role="gridcell" id="SubmissionsGrid_active_cell" class="">Active</td>

    The status column is a drop down list which I have been able to get working using the example in this article.

    I am trying to change the value for each selected row and flag the cell as dirty using the following code:

    $('#myButton').click(function() {
        var grid = $("#SubmissionsGrid").data("kendoGrid");
     
        $.each(grid.select(), function (index, row) {
            var cell = $(row).find('[name="status"]');
            cell.addClass("k-dirty-cell").prepend("<span class='k-dirty' />");
     
            var data = grid.dataItem(row);
            data.set('Status.Id', '3');
            data.set('Status.Description', 'Rejected');
        });
    });

    The problem I have is that I cannot get the dirty flag to work in conjunction with the change.  If I comment out the code that changes the value the k-dirty-cell class is added successfully and the web form shows the cell is dirty however when both code blocks are used the value is chanced but the cell does not show as begin dirty.

    I am using the MVC version of the grid.

    Thanks
    Paul
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 22 Dec 2014 Link to this post

    Hello Paul,

    The "k-dirty" flag needs to be added after the grid is refreshed. This means that you need to update the data items and then to wait for the updated to be applied. Check this Dojo demo that demonstrates this approach. Note that on every grid refresh, the old "k-dirty" flags will be lost.

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Daní
    Daní avatar
    303 posts
    Member since:
    Feb 2008

    Posted 10 Aug in reply to Georgi Krustev Link to this post

    Hi, I'm trying to manually add the dirty indicator but have no success. It seems the dojo demo is not working. 

    How can I manually set the dirty flag in a cell?

  5. Daní
    Daní avatar
    303 posts
    Member since:
    Feb 2008

    Posted 10 Aug in reply to Daní Link to this post

    Hi again,

    I finally could manage to add the dirty indicator but I'm now watching a weird issue. My project uses aurelia framework, polymer and some pro (grid, scheduler,...) kendo widgets.

    I have a complex scenario where I'm supplying a custom editor for cell edition in one of the columns. This custom editor opens a polymer modal to allow value edition. The strange issue is that once the modal is closed, grid seems to "refresh" and all dirty flags are removed, same effect than clicking on refresh button in data pager footer

     

    How can I avoid this issue?

  6. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 12 Aug Link to this post

    Hello Dani,

    I suppose that the issue you are experiencing is related to the way Aurelia integration (or your custom one) is implemented.

    I am afraid that we would not be able to provide much help here as the support service handles only built-in features of the widgets. What I would suggest you is to open a discussion in the support channels of Aurelia depending on the source of the Grid integration code.

    Regards,
    Georgi Krustev
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  7. Daní
    Daní avatar
    303 posts
    Member since:
    Feb 2008

    Posted 12 Aug in reply to Georgi Krustev Link to this post

    Hello Georgi,

     

    I finally could solve the issue by keeping a copy of current dirty cells before cell edition and then, once the the edition is finished restoring dirty cells.

     

    Anyway, I'd to know why, sometimes (not always a polymer modal is opened) the grid removes all dirty flags. What are the events or situations that force grid to refresh and remove the dirty flags? I can force this behavior by clicking on refresh button. Does grid publish an event to notify a refresh is done (or going to be done)?

  8. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 16 Aug Link to this post

    Hello Dani,

    The grid will remove the 'dirty' flags when its refresh method is called. It will be called when datasource changes.

    The widget will raise its dataBound event when the content is re-rendered as a result of 'refresh' call.

    Regards,
    Georgi Krustev
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
Back to Top
Kendo UI is VS 2017 Ready