Overriding default number of records per list page

Archived from the Xataface Users forum.

dbuckley — Sat Apr 04, 2009 11:45 pm

The default of 30 records is fine most of the time, but how do I override that for a particular table? I found the global Dataface_QueryTool_limit which I think sets that number for all tablesbut that isn’t what I want.

Thanks.


sophistry — Sun Apr 05, 2009 7:05 am

I believe you can set your default page limit by setting the default_limit parameter in your conf.ini file.

more information here…

http://xataface.com/wiki/conf.ini_file

Rory


dbuckley — Sun Apr 05, 2009 10:45 am

Hi Rory.

Yes, that appears to set the overall default, but thats not what I’m trying to acheive - I want to set it on a table by table basis.


shannah — Sun Apr 12, 2009 10:56 am

Many ways to do this. The key is to understand that the ‘-limit’ GET parameter controls this, so you can set this programmatically to set the limit.

One way is to add something like the following to the beginning of your index.php file:

Code: Select all
`if ( !$_POST and !@$_GET[‘-limit’] ){
    if ( @$_GET[‘-table’] == ‘table1’ ){
        $_GET[‘-limit’] = $_REQUEST[‘-limit’] = 10;
    } else if ( @$_GET[‘-table’] == ‘table2’ ){
        $_GET[‘-limit’] = $_REQUEST[‘-limit’] = 20;
    }
    etc…

}`