Menu

#88 DBPager -- Sort on joined columns

Core Class
closed-accepted
Code/Logic (73)
5
2007-10-16
2007-10-15
Eloi George
No

This patch allows DBPager to show sort buttons for joied columns. To take advantage of it, first create the JOIN like so:
$pager->db->addColumn('phpwsbb_forums.title', null, 'forumname');
$pager->db->addWhere('phpwsbb_forums.id', 'phpwsbb_topics.fid');

(Note that the addcolumn() on the first line renames the column name "phpwsbb_forums.title" to "forumname". That was done because the main table used already had a column named "title")

then add the joined column to the list of table columns.

$pager->table_columns[] = 'phpwsbb_forums.title';

The template tag that will be generated for the sort button will be the mane of the column with all periods replaced by the underscore symbol. Therefore "phpwsbb_forums.title" creates a template tag of PHPWSBB_FORUMS_TITLE_SORT.

Discussion

  • Eloi George

    Eloi George - 2007-10-15

    Patch for /core/class/DBPager.php

     
  • Anonymous

    Anonymous - 2007-10-16

    Logged In: YES
    user_id=400519
    Originator: NO

    Added. Thanks.

     
  • Anonymous

    Anonymous - 2007-10-16
    • status: open --> closed-accepted
     

Log in to post a comment.

MongoDB Logo MongoDB