Closed aniskasmi closed 1 year ago
This is outside the scope of the bundle as it requires clientside extension of DataTables through the preXhr event: https://datatables.net/reference/event/preXhr
You can achieve this result with something like this:
document.addEventListener('DOMContentLoaded', (event) => {
$('#mytable').initDataTables({{ datatable_settings(datatable) }}).then(dt => {
dt.on('preXhr.dt', (e, settings, data) => {
$.extend(data, {foo: 'bar'});
});
}
});
@curry684 Thx but i do this
var datatable = $('#data-table-sse')
.on('preXhr.dt', (e, settings, data) => {
$.extend(data, {request: 'testX'});
})
.initDataTables({{ datatable_settings(datatable) }}, {
responsive: true,
fixedColumns: true,
dom: 'Bfrtip',
buttons: [
{
text: 'Exporter en Excel',
action: $.fn.initDataTables.exportBtnAction('excel', {{ datatable_settings(datatable) }})
}
]
});
But on my $request on my Symfony Controller i din't get my custom request
Use the browser debugger (network tab) to inspect what's actually happening. This is all on the DataTables end and is not a part of this bundle's functionality.
I debug, and is work with search request but on first init, the request is not extend
@curry684
$('#data-table-sse').initDataTables({{ datatable_settings(datatable) }}, {
responsive: true,
fixedColumns: true,
dom: 'Bfrtip',
buttons: [
{
text: 'Exporter en Excel',
action: $.fn.initDataTables.exportBtnAction('excel', {{ datatable_settings(datatable) }})
}
]
}).then(function(dt) {
// dt contains the initialized instance of DataTables
dt.on('preXhr.dt', (e, settings, data) => {
$.extend(data, {'testX': true});
})
});
This code work, but only on search request, when is the initialisation of page the preXhr don't extend the request data
And same with this
$('#data-table-sse').on('preXhr.dt', (e, settings, data) => {
$.extend(data, {'testX': true});
}).initDataTables({{ datatable_settings(datatable) }}, {
responsive: true,
fixedColumns: true,
dom: 'Bfrtip',
buttons: [
{
text: 'Exporter en Excel',
action: $.fn.initDataTables.exportBtnAction('excel', {{ datatable_settings(datatable) }})
}
]
});
Hi,
I want sytem with GET parameter pass on link $is_delete=true if user click on like to display projects deleted only, when user have click my page reload with new parameter $is_delete=true
When i have this parameter i want to edit my
ORMAdapter
but he don't work, because i think the datatable is load on another HTTP Request without my previous GET parameter from original page ?If you can help me thx a lot