Closed happymacarts closed 2 years ago
Hi @happymacarts,
Every file in the vendor get's replaced when a new update is available. This isn't something i can change because of the way composer works. Also i suggest not editing vendor files.
For your issue, you can add data attributes with data and conditions. For example
Label::make('id')->condition('status_id === 6')->data(['deleted' => true]), //when deleted
Label::make('id')->condition('status_id !== 6')->data(['deleted' => false]), //when not deleted
Or add the status to the column by doing:
Label::make('id')->class('status-{status_id}'), //gives something like status-6
How would i add a row class? i want to add the "table-danger" class to rows that have a status = deleted (6)
Looks like i can just do this
$(document).on('dtrow:render', (event, row, data, table) => {
$(row).data('id', data.id);
$(row).data('data', data);
if( data.status_id == 6){
$(row).addClass('table-danger');
$(row).data('deleted', true);
}
});
Yes, you can use the triggers to chekc the data of each row. https://singlequote.github.io/Laravel-datatables/table-models#table-triggers
With the new ability to add triggers we have lost the ability to define custom createdRow events for example in my table model i used to be able to define
which would add a data-attribute to each row ( i know this example is basic but i use it to create custom interactions based upon the data properties
could the scripts.blade.php file be modified to append instead of replace?