We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Set state of all rows in grid to changed

Good day syncfusion,

Please is there a way to set the state of all records in a grid to changed, so that after the grid (in batch update mode) is rendered the 'update' button is immediately enabled and it will send all the items in the grid for update when the batch update is invoked?

I have tried using 'setCellValue' in the 'databound' event, hoping it will somehow change the state of the records, with no success.

Any reply will be appreciated. Thanks.

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team November 4, 2019 04:13 AM

Hi Halilu, 
Greetings from Syncfusion support. 
Query: Set state of all rows in grid to changed 
We have validated your query and you want change particular cell values at initial render and update button is in enable state in batch editing. You can achieve your requirement by using updateCell method and dataBound event of the Grid. Find below help documentation and Typescript sample link for your reference. 
var initial = true; 
function dataBound(){ 
  initial = false 

Thavasianand S. 

HA Halilu November 8, 2019 12:21 AM

Good day syncfusion,

Thanks for the update and apologies for late reply.

Unfortunately I could not get it to work. The method 'updateCell' did not exist in my mvc project.

I get the feeling I am missing something obvious. I assume your mvc generates the same js libraries that your pure js projects use? If not, then I suppose that is where the problem lies? Is there a workaround? Can I enable the pure js libraries while still using mvc?

Perhaps it is a version thing? I am using version

Also, please note that 'setCellValue' does update the values, but it does not make the 'update' button immediately enabled. Perhaps there is a method I can call after it updates the values which I could use to add all the databound items to the 'changed' list?

Any reply is appreciated, thanks

TS Thavasianand Sankaranarayanan Syncfusion Team November 11, 2019 02:04 AM

Hi Halilu, 

We have validated the provided information and by default, while using setCellValue then it updated the value in UI not data source so that it does not enable update button to update the value in datasource. If you want to update the value in data source then we suggest you to use the updateCell method. 

You can directly access the updateCell method in grid instances or through editModule.  

      grid.updateCell(0, "Freight", 4); // grid-> component instance 
      grid.editModule.updateCell(0, "Freight", 4); 

Please get back to us if you need further assistance on this. 

Thavasianand S.  

Live Chat Icon For mobile
Up arrow icon