fix: [genericElement:indexTable] Ignore row selector column

pull/73/head
Sami Mokaddem 2021-10-20 15:39:37 +02:00
parent 64fdd4d290
commit 7940920f3d
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
2 changed files with 9 additions and 1 deletions

View File

@ -21,9 +21,14 @@
} }
} }
if (!empty($header['element']) && $header['element'] === 'selector') {
$columnName = 'row-selector';
} else {
$columnName = h(\Cake\Utility\Inflector::variable(!empty($header['name']) ? $header['name'] : \Cake\Utility\Inflector::humanize($header['data_path'])));
}
$headersHtml .= sprintf( $headersHtml .= sprintf(
'<th scope="col" data-columnname="%s">%s</th>', '<th scope="col" data-columnname="%s">%s</th>',
h(\Cake\Utility\Inflector::variable(!empty($header['name']) ? $header['name'] : \Cake\Utility\Inflector::humanize($header['data_path']))), $columnName,
$header_data $header_data
); );
} }

View File

@ -4,6 +4,9 @@ $tableSettings['hidden_column'] = $tableSettings['hidden_column'] ?? [];
$availableColumnsHtml = ''; $availableColumnsHtml = '';
$availableColumns = []; $availableColumns = [];
foreach ($table_data['fields'] as $field) { foreach ($table_data['fields'] as $field) {
if (!empty($field['element']) && $field['element'] === 'selector') {
continue;
}
$fieldName = !empty($field['name']) ? $field['name'] : \Cake\Utility\Inflector::humanize($field['data_path']); $fieldName = !empty($field['name']) ? $field['name'] : \Cake\Utility\Inflector::humanize($field['data_path']);
$isVisible = !in_array(h(\Cake\Utility\Inflector::variable($fieldName)), $tableSettings['hidden_column']); $isVisible = !in_array(h(\Cake\Utility\Inflector::variable($fieldName)), $tableSettings['hidden_column']);
$availableColumns[] = $fieldName; $availableColumns[] = $fieldName;