Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted September 3, 20186 yr 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!
September 3, 20186 yr I have solved with a custom mixin but I also would know if exist a better solution.
September 4, 20186 yr Sorry, I’m on a mobile device now and don’t remember. I’ll post tomorrow in the morning if anyone else helps you.
September 4, 20186 yr 10 hours ago, Jon Erickson said: where do you define the Table key? Use: $table->resortKey = 'something'; It's enough to use a different resortKey per table.
September 4, 20186 yr 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).
September 4, 20186 yr Author 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. PHP: $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'; HTML: <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.
September 5, 20186 yr 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.
Archived
This topic is now archived and is closed to further replies.