Jump to content

Multiple Db/Table on same page, breaks pagination etc.

Jon Erickson

Recommended Posts

Hey all, I am displaying multiple Db/Tables on the same page which causes them to no work properly. I am assuming this is because the javascript functions are trying to be called on each table etc. How do I differentiate the tables so that the javascript only works on one table at a time and does not call the other one? Do I need to create separate table controllers for each of them? Thanks!

Link to comment
Share on other sites

Are you using the core.global.core.genericTable or core.global.core.table controller? They both handle the table differently. The genericTable does not process paginationClicked actions using the paginationKey while the regular table does. The regular table does not respond to tableSort actions but the genericTable does. Looking at the table controller, the resortKey is only used as a parameter when fetching new data for the table and the Table.php model only checks to see that it is present when returning the data. It does not differentiate the tables on a single page.

Below is how my tables are displayed. 


$table = new \IPS\Helpers\Table\Db( \IPS\perscom\Records\ServiceRecord::$databaseTable, \IPS\Http\Url::internal( 'app=perscom&module=personnel&controller=soldier&tab=service&id=' . $soldier->id, 'front', 'soldier_service' ), array( 'service_records_soldier=?', $soldier->id ) );
$table->include = array( 'service_records_date', 'service_records_text', 'service_records_document', 'service_records_soldier', 'service_records_id' );
$table->limit = 15;
$table->tableTemplate = array( \IPS\Theme::i()->getTemplate( 'servicerecords', 'perscom' ), 'serviceRecordTable' );
$table->rowsTemplate = array( \IPS\Theme::i()->getTemplate( 'servicerecords', 'perscom' ), 'serviceRecordRows' );
$table->rowClasses = array( 'service_records_text' => array( 'ipsTable_wrap' ) );
$table->sortDirection = $table->sortDirection ?: 'desc';
$table->sortBy = $table->sortBy ?: 'service_records_date';
$table->paginationKey = 'serviceRecordsPage';
$table->resortKey = 'serviceRecords';


<div data-baseurl="https://www.deschutesdesigngroup.com/index.php?/perscom/personnel/soldier/service/1/&amp;serviceRecordsPage=1" data-resort="serviceRecords" data-tableid="serviceRecords" data-controller="core.global.core.table" data-pageparam="serviceRecordsPage">

The other strange thing is...each table is under its own tab. When using the genericTable controller and I switch between the tabs, the correct tab data and table is loaded but the URL appears to be from the last tab, but the table parameters are from the current tab. Super strange. Using the regular table controller, the URL's are updated properly.

Link to comment
Share on other sites

I have a lot of situations with multiple ones on a page. I had planned on doing different pagination keys, but I can't remember if I did or not, so I'm glad you asked this, where I can look back and be sure I didn't forget and can either do that or the resort key.

In case you haven't noticed my other posts on it, a problem nobody seems able to figure out is when you put a Table/Db in a tab. A lot of issues come up then. Overlapping content from one tab to another, etc.... only happens on the public side, though.

edit: that post above about different table types is going to make it confusing, though, since they seem to have so many differences in how they handle things. I haven't really got into testing multiple pages on pages with my multiple tables yet, I don't think.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...