Checkbox state looks weird enabled/disabled (visible/hidden)
renepardon opened this issue · 4 comments
So the first one is disabled but why is the switch for the others also on the left?
And as mentioned here: #14 (comment)
If the id-column is set to enabled=false (which I think should be "hidden=true" or "visible=false") I'm not able to display the id column. All other columns can be hidden and displayed again except for the ones hidden (disabled) by default through the new third parameter.
I disable same line in
node_modules@protonemedia\inertiajs-tables-laravel-query-builder\js\InteractsWithQueryBuilder.vue
getColumnsForQuery(columns) {
let enabledColumns = filter(columns, (column) => {
return column.enabled;
});
// if (enabledColumns.length === Object.keys(columns || {}).length) {
// return [];
// }
return map(enabledColumns, (column) => {
return column.key;
});
},
and in controller i added
app\Http\Controllers\XxxxxxxController.php
$fields = request('columns') ?? [];
$table->addColumn('golongan', 'Golongan', in_array('golongan', $fields) ? true : false);
this not best pratctice but for now i used this for waiting update from this module...
@FranzaLeny it's never a good idea to directly change library code. Hope there will be an update soon or we need to make a pull request :)
Hi,
I've done the same. I can't have a column disable by default other way. It's simply doesn't work when I want to show the hidden default column, there is an automatic refresh that hide the column 500ms after I click the show button.
So I wait for the fix, during this time I use the @FranzaLeny solution.
$fields = request('columns') ?? [];
$table->addColumn('golongan', 'Golongan', in_array('golongan', $fields) ? true : false);
getColumnsForQuery(columns) {
let enabledColumns = filter(columns, (column) => {
return column.enabled;
});
//if (enabledColumns.length === Object.keys(columns || {}).length) {
// return [];
//}
return map(enabledColumns, (column) => {
return column.key;
});
},
Fixed in v2
