This is a migrated thread and some comments may be shown as answers.

Update other cells based on the edited cell value

7 Answers 902 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Crina
Top achievements
Rank 1
Crina asked on 18 Nov 2013, 01:21 PM
Hi,
I have a grid in batch edit mode.
I'm trying to update other cells values based  on the changes I make to the current edited cell but I'm not able to do that.
The value I set in another cell is  there but it is not visible until I click on that cell and I don't know why.
I was trying to refresh the grid but on grid refresh, the current cell exits the edit mode and I don't want this to happen (I have 2 values that I want to edit in a single cell).
Also I can see that the updated cells that are on the same row with the current edited cell are updated automatically, so my problem refers only to the cells that belongs to another row.
Can you help me with that, please ?
Thanks!

Crina

7 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 18 Nov 2013, 04:24 PM
Hello Crina,


The described behavior is expected. When setting the value of a property in a row, while editing a different row, the new value will be set in the model, but the row template won't be refreshed. This is only supported for the currently edited row as in following example.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Madzie
Top achievements
Rank 1
answered on 19 Nov 2013, 02:54 AM
On the same lines, as this example updates data in same row, Is it possible to change/copy the value of one cell to another in other rows too ?
Like if I updated a cell in row1, for the few of other rows (that is dependent on conditions) the same value is copied to other rows's cell (in same column) ?
It would be great if you can provide an example. Thanks in advance.
0
Crina
Top achievements
Rank 1
answered on 19 Nov 2013, 07:11 AM
Thank you for your answer Dimiter !
Since I need a solution to my problem (I have some kind of an hierarchical structure in the grid and I want to update parents values when a cell value has changed, so I have to update the column, not the current row ) I was thinking that it would be very helpful for me to catch the moment when the currently editing cell closes.
Do you know how could I do that ?
Thanks!

Crina
0
Dimiter Madjarov
Telerik team
answered on 19 Nov 2013, 12:19 PM
Hello guys,


As a workaround for the current scenario I would suggest you the following approach: bind to the save event of the Grid, which is fired when the editing of the current cell finishes and the data item is saved. In the event handler you could set the new values for the other items and call the refresh method of the Grid which will render again all of the rows with the new data from the dataSource. Here is a small JS Bin example to demonstrate this.

Wish you all a great day!

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Crina
Top achievements
Rank 1
answered on 19 Nov 2013, 01:18 PM
Thanks again Dimiter!
I have 2 fields that I'm trying to edit in the same cell and the save event raises as soon as I modify one of them. So, if I modify one of those 2 fields and I refresh the grid, the cell closes automatically and I cannot continue to edit the next field until I enter again the edit mode by double clicking the cell...
Do you have any other suggestion that might help me ?

Crina
0
Madzie
Top achievements
Rank 1
answered on 19 Nov 2013, 04:07 PM
Thanks Dimiter, this sample works fine for me in Chrome but not in IE 11 ! And I am talking about running the JS Bin itself not through my own code.
0
Dimiter Madjarov
Telerik team
answered on 19 Nov 2013, 04:46 PM
Hello guys,

Madhuri,
I am experiencing the same issue in IE 11 with JS Bin, but I assume that it is a specific JS Bin problem, as it is reproducing only in edit mode. You could take a look at the example in JS Bin non-edit mode to assure that it is working as expected.

Crina,
The example was intended to just demonstrate the general case scenario and a sample approach. In the current scenario you could include some custom logic to check whether both of the fields were modified and refresh the Grid only if this condition is satisfied. At the moment we do not have an example for this.


Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Crina
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Madzie
Top achievements
Rank 1
Crina
Top achievements
Rank 1
Share this question
or