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:
http://pastebin.com/m665ae618
Please ignore the messy code, its just a prototype.
Thanks,
Frederico