Hi,
I was using grid option AutoCommit to update my grid data after an add/edit/delete acton (note that I am not using batch mode to write on db).
It was all right, but then I decided to introduce Sorting feature and I have noticed this: if I use Sorting, autoCommit does not have effect, I have to refresh the page directly from the browser to let every added/edited/deleted row to be seen. I know for sure that controller action is called and oeprations on db are correctly executed.
Is there any solution?
Thanks,
Flavio
Hi Flavio,
I've attached an MVC3 sample project to this reply - can you please take a look at it and let me know if you can reproduce the problem you're facing with it?
I tried adding/updating and deleting rows and those operations worked fine with remote sorting.(Please note that I explicitly clicked the "Save Grid Changes" button after each operation in order to post the changes to the server-side)
Just a note: Remote sorting requires data rebinding which truncates any pending transaction so be sure that you are calling the saveChange() API method after each updating operation or before each remote feature operation (sorting for example).
Cheers,
Borislav
Hi Borislav,
I tested it better. Now I can give you more information about this "problem".
If I've added sorting to the features, but I don't use it (I mean that I am not sorting any columns), then if I add/edit/delete a row, I can see changes immediately happen on my screen view.If I use sorting on a column, then if I add/edit/delete a row I see that row still on my screen view and I have to refresh page to see changes happen. On the db is all correct.
I am calling saveChanges, but I am using local sorting. Is this the problem?
Ok.
autoCommit option always set to true.sorting feature always local.saveChanges always called after an update (no batch mode).
With the grid sorted by a column: the deleted row is shown the same after the saveChanges, it still persists on my screen (on the db the record is deleted right).
With the grid not sorted by any column: the deleted row is rightly deleted from the screen.
The second case is bad, because I want that the user is able to see the deleted row gone out of the view after a delete, but I can do it only if all the columns are not sorted. This is why I asked if I have to refresh the page...Thanks for your patience,
Thank you very much for the provided details - they're really helping me clarify the scenario :).
With that said, I tried deleting a row both before and after sorting a column and both scenarios were successful - the row was deleted from the database and removed from the grid.
Can you please try out my sample and see if you can reproduce the problem with it?I you are still experiencing it, can you give me one or more screenshots that can illustrate the problem?
(for example with the Firebug console visible (if you are using Firefox) so we can see the HTTP request for the deleted row and what was the result it returned)
Thanks in advance! Will be looking forward to your reply.
Hi again,
I took a closer look at my sample and I saw that I made a couple of small mistakes in it.So, in order to be sure we're checking for the problem with a good sample, I've re-uploaded it - you can find it attached to this reply.
Hope it helps.
Sorry,
I am not able to extract MDF files (corrupted). And so I am not able to load project and see if I can reproduce my problem on it. I will try to post here some pictures about this issue...
FlavioMaccarrone said: I am not able to extract MDF files (corrupted). And so I am not able to load project and see if I can reproduce my problem on it
I am not able to extract MDF files (corrupted). And so I am not able to load project and see if I can reproduce my problem on it
I am very sorry, but I found out that the problem is not related to the sorting feature as I thought. With only sorting and updating it works fine. The problem is the paging feature! When it is enabled, just with a few rows:
GridPaging paging = new GridPaging(); paging.Type = OpType.Local; model.Features.Add(paging);
(where model is a GridModel, created by controller side).
So what exactly happens? If paging is enabled, and a column is sorted out, when I delete a row, that row does not go out of the grid. I can see it going out of the grid re-sorting column, refreshing the view or changing the page (if I have more than one page related to the paging feature). Note that this problem does not depend on the number of pages that sorting feature gives us, also one grid page and just less than 10 records shows same problem. An note that problem is the same I described you: not a functional problem (record is correctly deleted from db), just a visualization problem (re-sorting the column correctly hide deleted row).
I hope to have been clear. Sorry for the time I stole you all with previous posts, I was sure that only the sorting was the problem, but I noted that sorting + updating works fine, updating + sorting + paging does not work right.
Borislav, could you look at it and give me your feedback?
Thank you very much,
Hi Flavio,I just put local paging in my MVC sample and deleting a row works before and after a column has been sorted.
I did try this with local paging and local and remote sorting - both combinations worked fine.
I'm perplexed because I can't reproduce the issue, so can I ask you to provide us with:
1. The code which you are using to configure the igGrid
or2. An MVC sample (with dummy data) which I can run where the issue can be reproduced.
PS: I've uploaded my MVC sample to my SkyDrive account so you can download it from:
https://skydrive.live.com/redir.aspx?cid=e4cf03e23fe33afe&resid=E4CF03E23FE33AFE!125&parid=E4CF03E23FE33AFE!122You should have no problems with the database (I've made it with MSSQL Server 2005 Express for maximum compatibility with later versions)
do you get any sort of errors in the error console ? Have you set a primaryKey for the grid?
Thanks
Angel