Responsive tables in CMSB

13 posts by 3 authors in: Forums > CMS Builder
Last Post: July 22, 2023   (RSS)

By Djulia - July 20, 2023 - edited: July 21, 2023

If you want to use it for all tables you have to remove the condition (if).

//
function _customtdAttributes($tdAttributes, $tableName, $fieldname, $record) {
	$fieldLabel = _getFieldLabel($fieldname);
	$tdAttributes = 'data-title="'.$fieldLabel.'"';
	return $tdAttributes;
}

>>I thought that [data-table] was a general term if you need to use for all tables
[data-table] is just a css attribute selector. The plugin targets your Mysql tables.

>>Also, do you know if it Is possible to apply the same responsive type of tables in the reports as well?
In reportBuilder.php, line 196 replace :

<table cellspacing="1" cellpadding="0" border="0" class="data table table-striped table-hover">

with :

<table cellspacing="1" cellpadding="0" border="0" class="data table table-striped table-hover" data-table="report-builder">

Ilne 216 replace :

<?php foreach ($row as $fieldValue): ?>
<td><?php echo htmlencode($fieldValue); ?></td>
<?php endforeach ?>

with :

<?php foreach ($row as $key => $fieldValue): ?>
<td data-title="<?php echo htmlencode($key) ?>"><?php echo htmlencode($fieldValue); ?></td>
<?php endforeach ?>

Thanks,
Djulia

By andreasml - July 22, 2023

Hi Djulia, 

Nothing more to say (until my next question...). Just, many many thanks.

Kind regards, 

Andreas Lazaris