Hi Chris,
Thanks for contacting Syncfusion support.
Query: “it doesn't actually update and it stays green highlighted even after i click yes to save changes”
We have analyzed your query and we would like to inform you that Batch editing is used to perform edit operation on multiple records at same time. And save all the changes in Grid upon single click (i.e.) Update Toolbar button. So the highlighted cell in Green color indicated that, there is some changes in cell which is not updated in Grid. Now clicking the update button will save the changes in grid.
You have mentioned that cell appear to show green color even after clicking the yes button. We have ensured the reported issue at our end and we are not able to reproduce the reported issue. Kindly download the sample from below
After referring the sample, if you are still facing the issue. kindly get back to us with following details.
- Share your Grid code example.
- Are you facing any exception / error in browser console while saving the changes?
- Share the more details about your query.
- If possible try to reproduce the reported issue with provided sample and revert back to us.
Above requested details will be helpful for us to validate the reported query at our end and provide solution as early as possible.
Query: “ Also how do i override the methods so when i click update or delete etc. it will make certain calls to the database with the updated data. I attached my grid code.”
We suggest you to achieve your requirement (to save the changes in Database) using OnBatchSave event of the Grid. This event will be triggered when saving all the changes (as a whole) in Grid. In the event argument we can get the changes performed in Grid, like changed record, added record, deleted records etc. Using these value, we can update the changes in Database.
Refer the below code example.
|
<SfGrid DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchSave="OnSave" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Batch"></GridEditSettings>
. . . . . .
</SfGrid>
@code{
public List<Order> Orders { get; set; }
public void OnSave(BeforeBatchSaveArgs<Order> Args)
{
var BatchChanges = Args.BatchChanges;
if(BatchChanges.AddedRecords.Count > 0)
{
//Insert data into your database
}
if(BatchChanges.ChangedRecords.Count > 0)
{
//update changes into your database
}
if(BatchChanges.DeletedRecords.Count > 0)
{
//delete record from your database
}
} |
Refer our UG documentation for your reference
Query: “Is there a way to set the order? also is there a way to navigate through the grid with arrows to each cell?”
Yes we can navigate through the each cell in Grid using arrow keys once the cell is selected. While editing a cell using batch edit mode, tab key is used to navigate the next cell and perform edit operation in next cell. Are you facing any issue while using tab key. Or do you want to change the tab behavior to navigate from second column to 4th column as example?. Kindly confirm do you want to achieve above behavior?.
If not kindly share more details about your requirement along with video demonstration.
Regards,
Vignesh Natarajan