I'm still looking, but I am having trouble coming up with how one converts tablesort_sql to the new DBTNG stuff. Does anybody have a link handy? Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
On Mon, Sep 21, 2009 at 6:59 PM, Nancy Wichmann <nan_wich@bellsouth.net> wrote:
I'm still looking, but I am having trouble coming up with how one converts tablesort_sql to the new DBTNG stuff. Does anybody have a link handy?
TableSort now works as an Extender, so you need to convert your query to a dynamic db_select() query. You then need to extend it with "->extend('TableSort')" and add the table header by calling "->orderByHeader($header)". Some Links: An example from core: http://api.drupal.org/api/function/poll_votes/7 Extender doc page: http://drupal.org/node/508796 Berdir
Sascha Grossenbacher wrote:
TableSort now works as an Extender
Thanks. It's going to take a while to get used to the new terminology. We could also use some more targeted examples in the handbooks (yeah, I know "you can do it"). Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
Berdir's helpful advice already is integrated into the Dynamic Queries page [1] but as you say, feel free to add whatever else you learn :) [1] http://drupal.org/node/310075
-----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org]On Behalf Of Nancy Wichmann Sent: 21 September 2009 19:37 To: development@drupal.org Subject: Re: [development] D7 and Tablesort
Sascha Grossenbacher wrote:
TableSort now works as an Extender
Thanks. It's going to take a while to get used to the new terminology. We could also use some more targeted examples in the handbooks (yeah, I know "you can do it").
Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.111/2386 - Release Date: 09/21/09 05:51:00
On Mon, Sep 21, 2009 at 9:15 PM, Will Moy <idealworld@orange.net> wrote:
Berdir's helpful advice already is integrated into the Dynamic Queries page [1] but as you say, feel free to add whatever else you learn :)
I updated the example a bit, because it contained a quite common error. The extend() method does return a new object that needs to be used. See http://drupal.org/node/508796 for more information and an example. Berdir
Guess I got lucky: $select = db_select('node', 'n')->extend('TableSort'); $results = $select->fields('n', array('nid', 'title', 'type', 'created', 'status', 'sticky', 'promote'))->orderByHeader($header)->execute(); Nancy E. Wichmann, PMP Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr. -----Original Message----- From: development-bounces@drupal.org [mailto:development-bounces@drupal.org]On Behalf Of Sascha Grossenbacher Sent: Monday, September 21, 2009 3:41 PM To: development@drupal.org Subject: Re: [development] D7 and Tablesort On Mon, Sep 21, 2009 at 9:15 PM, Will Moy <idealworld@orange.net> wrote:
Berdir's helpful advice already is integrated into the Dynamic Queries page [1] but as you say, feel free to add whatever else you learn :)
I updated the example a bit, because it contained a quite common error. The extend() method does return a new object that needs to be used. See http://drupal.org/node/508796 for more information and an example. Berdir No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.110/2385 - Release Date: 09/21/09 05:51:00
participants (3)
-
Nancy Wichmann -
Sascha Grossenbacher -
Will Moy