Attempting to implement an exclude button for the multi_select filter_type
, utilizing multi_select_custom_func
. Also experimenting with custom_funcp
. The issue at hand is the custom function never gets invoked. I have verified that it falls within yadcf's scope as I've executed a call right before initialization to test it.
My goal is to integrate this feature with server-side data retrieval (for both the table and select boxes) and AJAX pagination. Any additional tips or recommendations would be greatly appreciated.
Unable to replicate the problem in a snippet due to the requirement of server-side loading. However, I was able to resolve it without server-side loading. Suspecting the issue may be related to the columns
parameter in the datatable setup.
Here are the parameters being utilized:
columns = [
{ data: "count" , title: "Occurrences" },
{ data: "source" , title: "Source" },
{ data: "relationship" , title: "Relation"},
{ data: "target_label" , title: "Target" },
{ data: "target_type" , title: "Target Type"},
{ data: "relationship_uri" , title: "Details", sortable: false,
render: function ( data, type, row, meta ) {
return `<a href="${data}"><i class="material-icons text-info">info</i></a>`;
}
}
]
table = $(table_html).DataTable({
pageLength: 10,
buttons: [
{
text: 'Reset Filters',
action: function ( e, dt, node, config ) {
yadcf.exResetAllFilters($(table_html).DataTable());
}
}
],
sDom: "<'row'<'col-sm-4'l><'col-sm-4'B><'col-sm-4'i>><'row'<'col-sm-12'tr>><'row'<'col-sm-12'p>>",
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
serverSide: true,
ajax: url,
processing: true,
deferRender: false,
responsive: true,
//stateSave: true,
bAutoWidth: false,
bSortCellsTop: true,
columns: columns,
order: [0, 'desc']
});
yadcf.init(table, [
{
column_number: 0,
filter_type: "range_number"
},
{
column_number: direction == 'in' ? 1 : 3,
filter_type: "multi_select",
select_type: 'select2',
sort_as: 'none'
},
{
column_number: 2,
filter_type: "multi_select",
select_type: 'select2',
sort_as: 'none'
},
//3rd is the 1
{
column_number: 4,
filter_type: "custom_func",
select_type: 'select2',
sort_as: 'none',
custom_func: myCustomFilterFunction,
data: [{
value: 'Donna',
label: 'Donna'
}, {
value: 'sad',
label: 'Sad'
}, {
value: 'angry',
label: 'Angry'
}, {
value: 'lucky',
label: 'Lucky'
}, {
value: 'january',
label: 'January'
}],
filter_default_label: "Custom func filter"
}
],
{filters_tr_index: 1}
);