Maybe I am too tired but I just can't figure out how you are supposed to do this. I am trying to use the tablesort and pager together with data form a form to list some things.
In my test I have one form with two fields (name_first,name_last), this form is created with drupals form-function and therefore the fields are put in edit['_name_']. The test selects persons from db and lists them in a table, so far everything works as expected. I was rather impressed by how easy it was, but then I realized that it wasn't (or more likely I am doing something wrong).
First problem was that the headerfields in the table, that are supposed to reorder table when clicked, didn't work because they had 'edit=array' in the querystring. Hacked around this by changing /includes/tablesort.inc:tablesort_get_querystring() to a function found here (http://www.php.net/manual/en/function.http-build-query.php) which worked fine.
Next problem was that the "next page" (links) also included "edit=array" in the querystring. One hack was acceptable, but when I had to do another I realized that I must be doing this the wrong way.
Is there someone who can explain how this is supposed to be done the best way? Or knows a module where this is done correctly (or at least without hacking core) that I can look at?
Comments
need to patch
hopefully this patch will hit core soon. it should fix your problem.
I don't really see how this p
I don't really see how this patch will change anything. If I understand correctly it only removes the edit=array from the querystring, which would mean that I wouldn't get access to the data from the form. My stupid hack to tablesort.inc at least gave me access to this.
This patch does nothing to the second part of the problem concerning how the pager builds its links. The only workaround seems to build forms without drupals form-functions and thus avoiding the edit-array in these cases.
Thanks anyway,
Quick fix without core modification
I'm using tablesort, pager and a search form. To get around the problem you have (had?), I changed the request method of the form to GET, and added a hidden element, q, which keeps us on the same page after submitting the form, and avoided the form_ functions that fill up the $edit array. This is not a graceful way to get it to work, but there it is.
I realize now that you've already thought of this (reading your last post). Oh well.