This is a migrated thread and some comments may be shown as answers.
Manually Updating Multiple Values
7 Answers 221 Views
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 18 Dec 2014, 11:19 AM
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

7 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 22 Dec 2014, 09:14 AM
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!
 
0
Daní
Top achievements
Rank 1
answered on 10 Aug 2016, 10:04 AM

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?

0
Daní
Top achievements
Rank 1
answered on 10 Aug 2016, 11:00 AM

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?

0
Georgi Krustev
Telerik team
answered on 12 Aug 2016, 07:31 AM
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.
 
0
Daní
Top achievements
Rank 1
answered on 12 Aug 2016, 08:02 AM

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)?

0
Georgi Krustev
Telerik team
answered on 16 Aug 2016, 07:17 AM
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.
 
0
Markus
Top achievements
Rank 1
answered on 04 Sep 2018, 08:58 AM

Updated dojo, just in case anyone is looking for it:

http://dojo.telerik.com/UqiqUTiV

Tags
Grid
Asked by
Pete
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Daní
Top achievements
Rank 1
Markus
Top achievements
Rank 1
Share this question
or