Forum
03:34
Moderators
30/10/2007
Hello,
Or simply use onPaging event to store selected Ids
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
10:21
25/10/2008
Hello again,
I tried doing this with the onSelectRow event and it works, the problem is i use the multiselect option that uses the onSelectAll event.
Unlike onSelectRow, that always returns the id weither you are selecting or deselecting, onSelectAll only returns the id's that you select. This is a problem because i can add the selected row's id to a cookie, but cannot remove them because i dont know which were removed.
Another problem is when i call the setSelection function to reselect the rows on page change, it calls the onSelectRow event, and because i'm using a code that works like toggle to add and remove id's from the cookie (if it exists removes it, else it adds it) it removes all of the selected id's.
I hope i made myself clear, here's the code i use so someone can take a look:
Please ignore the messy code, its just a prototype.
Thanks,
Frederico
11:05
Moderators
30/10/2007
Hello,
Sorry for this, but there is undocumented parameter in onSelectRow -
onSelectRow(rowid, selected) - where the selected is valid only in multiselect mode and is true when the row is selected and false if delselected.
But as for the news you can read in the docs-
- Added a second parameter to setSelection: onselectrow (boolean, default true). If set to false, the onSelectRow is not launched
Hope this helps
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
12:11
25/10/2008
Hello Tony,
Thanks for the fast reply.
That argument sure helps, but when I click on the top checkbox (the one that selects all the rows in that page) it doesnt call the onSelectRow event, instead, it calls the onSelectAll event. Is there a way to call the onSelectRow event anyway for each item when clicking this checkbox?
Edit:
I realised that onSelectAll also has that second argument, but it doesnt return the id's when deselected like onSelectRow.
Thanks,
Frederico
12:40
25/10/2008
Ok, i hacked a line in grid.base.js and had the result i wanted:
After line 1296, i added:
ts.p.selarrrow[i]= ts.p.selrow = this.id;
And on line 1299, I commented:
ts.p.selarrrow = []; ts.p.selrow = null;
This way, the event onSelectAll has the same behaviour as onSelectRow.
If this doesnt break anything, I would like to resquest that it would be implemented in a future release.
As soon as it's ready, I will post the final code to maintain row selection when changing page.
EDIT:
Just realized it breaks getGridParam('selarrrow'), going to insert those results in a seperate array to return them.
Thanks for the help,
Frederico
18:32
25/10/2008
Ok, its all working now. For those interested I posted the code on pastebin. You'll need the jquery cookie plugin:
Maintain selection changing pages:
http://pastebin.com/f778c1db *UPDATED*
Little hack to the multiselect function. starts on line 1276 of grid.base.js (hope this gets included in future releases):
I'm not really a javascript programmer, so any improvements are welcome. Please post them here.
Thanks to tony for all his support.
Most Users Ever Online: 715
Currently Online:
64 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66