- Home
- Forum
- ASP.NET MVC - EJ 2
- Set state of all rows in grid to changed
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.
SIGN IN To post a reply.
3 Replies
TS
Thavasianand Sankaranarayanan
Syncfusion Team
November 4, 2019 09:13 AM UTC
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(){
if(initial){
this.updateCell(0,"CustomerID","zzzz");
this.updateCell(1,"Freight",44);
this.updateCell(2,"CustomerID","ASWIN");
this.updateCell(3,"Freight",22);
this.updateCell(4,"ShipCountry","Brazil");
initial = false
}
} |
Regards,
Thavasianand S.
HA
Halilu
November 8, 2019 05:21 AM UTC
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?
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 07:04 AM UTC
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);
|
Help documentation: https://ej2.syncfusion.com/documentation/api/grid/#updatecell
Please get back to us if you need further assistance on this.
Regards,
Thavasianand S.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
HA Halilu
- Nov 2, 2019 12:55 AM UTC
- Nov 11, 2019 07:04 AM UTC