Save the sort state of a datatable
Save the sort state of a datatable
Hi,
In my application, I want to sort the table and save the state to DB, so that when I login next time I want to see table with the same order I that I sorted previously. Please help me to find a solution for this. I am using Oracle ADF ans my development environment and Oracle as my Database. I am planning to store the status to DB after sort. How can I pass the sort state to my Java class?
In my application, I want to sort the table and save the state to DB, so that when I login next time I want to see table with the same order I that I sorted previously. Please help me to find a solution for this. I am using Oracle ADF ans my development environment and Oracle as my Database. I am planning to store the status to DB after sort. How can I pass the sort state to my Java class?
This discussion has been closed.
Replies
Allan
thank you for the support. I am using Oracle ADF and Oracle DB. How can I get the selected value from Datatable that, which table head is clicked and in what order it is sorted. If I get this, how can I pass the value from my JQuery to my Java class?
Enable state saving and then use the two callbacks I mentioned before. Or you could bind a click listener to the TH elements and use fnSettings().aaSorting .
> If I get this, how can I pass the value from my JQuery to my Java class?
Make an Ajax call to the server which is running the Java app.
Allan
Thank you very much for your valuable support. I got three values from fnSettings().aaSorting. it is
( 4, asc, 0 ). Forst one is the head number and the second one is the sorting order and what is the last value?
I am using rowGrouping to group the table rows with a condition.
If I put the below code, the rowGrouping fails
"fnStateSave": function (oSettings, oData) {
alert("=== oData === "+oData);
-- Send an Ajax request to the server with the state object
$.ajax( {
"url": "/state_save",
"data": oData,
"dataType": "json",
"method": "POST"
"success": function () {}
} );
},
If I get the value from DB, how can I set it back to datatable? is there any function avilabe to set it from DB to sort the state of the table ?
Allan
I have a small doubt too. Is it possible to change the row values fully by drag and drop to another location in the same table?
Allan
Thank you for your support. I can save the sort order into DB and from there I set it back to datatable on page load of my application. Thank you for your support once again.
And one more. Can you plz provide a small example for drag and drop table rows properties... it will be helpful for me in another application. Also, it it possible for saving that state too?
Regards,
Allan
Thank you for your response. Regarding the purchase of support, I have to consult with my company authorities. Once I got the reply from their end, I will contact you.
Without disable the sorting feature, we cannt implement this? If it possible to store the order after drag and drop in to DB?
Regards,
Joby Joseph
[code]
A
B
C
D
[/code]
If you dragged C into the top position, as soon as the table redraws (i.e. does a sort) the 'C' will end up right back where it was. If you can see a way around then, than I'm more interested to know what it is, but I don't see how the two would be compatible.
Allan
Consider, one person want to sort from the table header. but another one want to arrange the table by drag and drop the table rows. That is why I asked, is it possible to apply both in the same datatabe.
Allan
Saw one plugin
http://jquery-datatables-row-reordering.googlecode.com/svn/trunk/index.html
and I tried to implement the same in our application. I am not able to see any changes in it. I have uploaded it to debugger and the link is
http://debug.datatables.net/oqinuf
Can you please check is this the correct way i have impleemntd it. Now i commented out the part used for row reordering.
You can see it there in the code as
oTable.rowReordering(); --- as commented
Please check it and correct me if I did anything wrong
Regards,
Joby Joseph