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

sync cell value without rebind?

5 Answers 181 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lihong
Top achievements
Rank 1
Lihong asked on 12 Oct 2015, 06:18 AM

Hello,

 I have a grid with detail template, and a button in detail section will change one cell value of its master row.

The question is that, after cell value is changed (datasource.set), this grid is rebind, original detail of this row is gone, and this row is unselected. This isn't what I want.

Is there a way to avoid rebinding this grid, I just want to change a cell value​ without rebind, and keep this detail section, this selected row etc..

5 Answers, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 13 Oct 2015, 03:57 PM

Hello Lihong,

 

The main idea of rebinding and repainting the Kendo UI Grid after modifying a model field value using the set method is to update the cell value (display the new value in the cell element). Otherwise the table cell will display the old value.

 

The only way to achieve such behavior without repainting the Kendo UI Grid is to find the table cell DOM element and change its value.  

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lihong
Top achievements
Rank 1
answered on 14 Oct 2015, 01:41 AM

In your method, will be value in data source changed?

My purpose is that, without rebind and repaint grid, change a field value (datasource.set), then related cell should be changed too.

This is very useful in fact.

Is there a way?

0
Boyan Dimitrov
Telerik team
answered on 14 Oct 2015, 03:11 PM

Hello Lihong,

 

When the grid is rendered it takes the model field value and display it in the cell. This is why after modifying the model field using the set method, the grid is rendered again and the new value will be properly shown. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Lihong
Top achievements
Rank 1
answered on 15 Oct 2015, 06:35 AM

I'm really disappointed with your grid.

I can't really understand, why you repaint the whole grid when a field value is changed​?

I just want to know, whether there is a way, a ​cell value synchronizes with ​its field value without repaint?

If no, we may consider abandon the use of this grid.

0
Boyan Dimitrov
Telerik team
answered on 16 Oct 2015, 02:49 PM

Hello Lihong,

 

I am afraid that when a model field value is changed using the set method, the Kendo UI Grid will be redrawn and rebound. This is caused due to the fact that when change event of the Kendo UI DataSource is fired the Grid is rebound. The change event is fired when a value of the model is updated/delete or a new item is created. This is how the Kendo UI Grid is designed to work and how it synchronizes changes made to the model with the UI. 

 

My suggestion would be to take a look at the Persist expanded rows after refresh example that demonstrates how to persist expanded rows after refresh. The parent grid will be refreshed, but the lastly expanded row will be expanded again in order to retain the expanded state. 

 

Another possible solution is to use two separate Kendo UI Grid widgets on the page. The second one to be populated with data when a selection from the first (master grid) is made. Considering the fact that both grids are completely separate even if the master grid is rebound and redrawn the child grid will remain same and will not be affected. In order to achieve this functionality you can use the change event of the master grid and populates the second grid based on the selected date item. 

 

Regards,
Boyan Dimitrov
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
Lihong
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Lihong
Top achievements
Rank 1
Share this question
or