jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Editing a sorted column
This topic contains 12 replies, has 3 voices, and was last updated by Peter Stoev 10 years ago.
-
AuthorEditing a sorted column Posts
-
Hi
If I sort my grid and then edit one of the values that have been sorted, the grid sends the update to the server, and then reorders randomly and sometimes blanks data. A refresh clears this. Should I be doing a refresh once the edit returns successful?
I have the updaterow set up, and the commit part is being called, is this where I should add the refresh?
I’m looking at the documentation here:
http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm
and the example here:
and I have an example here:
http://jsfiddle.net/nigeljohnson73/cnsd2qnw/6/
Click the ‘Page’ header and then add a text entry into one of the empty cells.
If I switch off the virtual mode, jsfiddle seems to work, but then there is no data going to or coming from the server. Also, if I edit a field that is not the sorted one, everything works as expected.
What am I missing?
Kind regards
NigelHi Nigel,
You’re missing the fact that Server sorting is handled by your server, not by jqxGrid. I suggest you to look more examples about using jqxGrid with PHP.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter,
I am not missing this fact, and yes it should be. My server side sorting filtering and editing is working fine, *except* when I edit a sorted field. In my head one of two things should occur. Either:
1. I edit the field, press return, the update is sent to the server, success is returned, commit is called, and thats it (which I guess happens in every other field I would edit), in which case I could do a refresh of the list if I wanted to.
2. I edit the field, press return, the update is sent to the server, success is returned, commit is called, the commit function recognises that I edited the sort column and calls the server refresh for me to get a resorted list.what seems to be happening is:
3. I edit the field, press return, the update is sent to the server, success is returned, commit is called, and my screen is replaced with a whole bunch of crazy. Several rows being blanked, and some rows are reordered to the point that using navigation starts jumping around. No second server call is made to resort, but the data is reordered in a VERY BROKEN manner.
Kind regards
NigelHi Nigel,
jqxGrid displays your data i.e what you return from your Server. In server side mode, the Grid is just a View and your code provides the Data and how Data will be displayed.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHave you tried my example I have provided. It does not do this. It reorders the list. On my server it also reorders the list without a second server call to do the reordering. The examples involving editing show that the return is just a single ‘1’. Should I be returning all of the data, now sorted again after an update?
Tried returning all the rows again. it doesn’t work.
Hi Nigel,
Yes, I tried your sample and it is invalid due to the fact that you mix Virtual Mode with Client Sorting, Client Editing. This will never work. This requires Server Sorting and Server Filtering and Server Editing.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comOk, I can see you’re getting confused with my wanting to provide you all the information you will need, lets take another look.
My actual server is doing the sorting on my real page. I can’t point you at my real page as its behind a login. I have made a video to demonstrate my problem on my server
https://www.youtube.com/watch?v=meBdA1t1vxU
In Summary:
1. My server correctly edits things because I copied the example. The update call returns “1” as per the example.
2. My server correctly sorts things because I copied the example and integrated it. The sort call returns all the data as per the example.
3. My server correctly pages and filters because I copied the examples and integrated them. The sort/page and filter call returns all the data.I can’t find an example that sorts and edits on the server in the PHP integration section.
I wanted to provide you with an example, and the JSfiddle exhibits the same behaviour. I understand that virtual mode means do stuff on the server and probably won’t work in JSfiddle without implementing the /echo stuff, but it exhibits the same behaviour. on my server, no second call is made to reorder the list, but it happens anyway.
Hi Nigel,
Having empty Grid means that your Server returns Empty List. Believe me, I am not confused because I know how to work with this widget.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThen can you please help.
So should the update call return the data? This is not what the example/documentation does, and this does not work. When my grid returns an empty list the grid is indeed empty, no grid lines, no rows. That is also not happening here. I have gridlines, I have rows, I can navigate, the pager says I have data. It’s just blank, and sometimes some data is present in random rows.
In fact I cannot find an example that covers server side editing and sorting, so I’m just guessing that the integration of server side editing and server side sorting should work as the independent examples show.
I have shown you exactly what my server does including the returns it provides. I have attempted to provide a demonstrative example, but ok, it won’t work properly, sorry about that.
Please, stop telling me to go RTFM when I have obviously done this to get as far as I have and obviously missed the one bit of information or setting that I need. I have implemented and integrated the multiple examples which your examples do not cover, and they all work independently so I must have done that mostly right. When I integrate them all I am getting behaviour that I do not understand.
WHAT DO I NEED TO LOOK AT TO FIX THIS?
WHAT MISTAKE HAVE I MADE IN MY CODE?
WHAT IS MY SERVER DOING WRONG?I would be happy if the update returned with success and then nothing else happened, like editing any other field in the table. There certainly isn’t another call to the server to resort the list, and that is fine. Lets say I don’t want that.
There isn’t another call to the server to resort the list on my working server, but the list reorders anyway.
The way I have implemented this, based on the combination of multiple examples works fine sorting, and fine when editing, and fine when I sort a list but edit a different field. Different behaviour occurs when I edit a field that is sorted, and I need to stop it, or make it work. I really don’t care which.
Hi Nigel,
Why do you set unboundmode: true? Where did you see this in an example with Virtual Mode/Server Paging and you decided to set it? Where is your source object’s updaterow callback implementation which makes Ajax call to your Server? That is pointed out in the samples and it’s not in your code. This is a widget with many features and many options and when someone does not understand how to work with it, I will point him to examples and documentation!
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAh ha, so its the unboundedmode that you believe is causing the issue? you could have just started with that. I’ll take a look at that.
The reason for using unboundmode is that I need the spreadsheet functionality. As per here:
http://www.jqwidgets.com/create-a-spreadsheet-with-jqxgrid/
I need spreadsheet mode, so I need filtering and sorting and editing all server side. I have integrated all of these examples, and they all work well independently.
As I said in my previous post. I apologies for the jsfiddle to give you information that you could use to help. Please can we forget the jsfiddle ever happened.
As I also said, on my server I do have, as per the edit example, a working updaterow callback and it works perfectly as per the video I posted, returning a “1” to indicate success and to trigger the commit() function. I may have mentioned, but I’ll mention it again. the updating works fine on my server if I edit any row that is not sorted. Exactly as per the example. The updaterow callback does not specify any of the paging or sort parameters that are added automatically in the other examples.
Pointing someone at the examples and documentation is fine as long as you give them a hint of what they need to look for. Or, if the documentation explained more about some of the settings, or possibly had a search function.
Hi Nigel,
You’re using jqxGrid and you just have to click on jqxGrid item on the documentation page to see the jqxGrid’s help topics. It’s not necessary to have search for that. It’s necessary for the API which is big and there is Search Option there – http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-api.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.