September 3, 2018 in Developer Connection
I have solved with a custom mixin but I also would know if exist a better solution.
You just need to use a different key for each table.
@Adriano Faria where do you define the Table key?
Sorry, I’m on a mobile device now and don’t remember. I’ll post tomorrow in the morning if anyone else helps you.
10 hours ago, Jon Erickson said:
where do you define the Table key?
where do you define the Table key?
$table->resortKey = 'something';
It's enough to use a different resortKey per table.
You can also use a different $paginationKey to prevent conflicts with pagination (e.g. in the event you link to a specific page in the table).
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/&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.
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.
This topic is now archived and is closed to further replies.
Started Monday at 08:21 PM
Started 7 hours ago
Started Yesterday at 02:01 AM