-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use this version instead #132
Comments
you're right, works like a charm and fast |
The library (Same with this) is hardcoded to process POST requests, but datatables will by default use GET. So make sure in your DataTables init you sent "POST" like:
You could also check your XHR request log in chrome dev tools and providing you are showing php errors it might reveal something else. |
hi, a close look inside the library later i've seen it deals with a columns value in the get_filtering function but not a single column index one so i've tried naming my column data into columns, thinking it could work as a single value array, nope, still have to dig a little big deeper i'm afraid :) of course, ajax, so i've tried putting this inside the ajax complete function but no more success :) (when the use of tooltips works fine this way) unfortunately, chrome console doesn't find anything to say :) i was the way i used the original library with CI 2 (i still have some tools working fine like so) too bad it doesn't work with CI3 but this fork is really fast and works really well except when it comes to column ajax filtering, i'll continue to try and understand why... or more precisely, how i could have it deal with that single column index... have a nice day |
Hmm I think you should try and keep to defining searchable columns within the init of the plugin like so and fix the real issue. Ensure you have XHR requests logging turned on (right click console window). Turn logging threshold for errors and check application/logs for other errors to do with the query. Paste it all up here if you want me to take a look (including Controller side query for the data.
|
just a word to say, of course it's draw() not .draw()(); :) |
just seen your message, i'll try this instead of my columnDefs declaration, beeing back soon :) |
nope, doesn't work... $('#users_list tfoot th').each( function (i) {
if ( i != 0 && i != 5 && i != 6 )
{
var title = $('#users_list thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" placeholder="'+title+'" data-index="'+i+'" />' );
}
});
var ctable = $('#users_list').DataTable({
"processing": true,
"serverSide": true,
"lengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "tout"]],
"pageLength": 20,
"ajax": {
"url" : "/mpprivate/users/users_tab",
"type": "post",
'complete': function(){
$('.toollink').tooltip();
}
},
"columnDefs": [
{ "name": "prenom", "targets": 1 },
{ "name": "nom", "targets": 2 },
{ "name": "cp_ville", "targets": 3 },
{ "name": "pays", "targets": 4 },
{ "name": "valide", "targets": 5 },
{ "visible": false, "targets": 0 },
{ "searchable": false, "targets": [5,6] },
{ "orderable": false, "targets": [5,6] }
],
"order": [[ 2, "asc" ], [ 1, "asc" ]],
"language": datatabfr
});
$( ctable.table().container() ).on( 'keyup', 'tfoot input', function () {
ctable
.column( $(this).data('index') )
.search( this.value )
.draw();
}); and, just to be as complete as possible
the ajax url does something really simple public function users_tab()
{
$this->datatables
->select('mp2018_user.id, prenom, nom, cp_ville, pays, valide')
->from('mp2018_user')
->add_column('voir', '<a href="/contacts/un_contact?idcontact=$1" title="voir / modifier" class="toollink"><i class="far fa-eye fa-lg"></i></a>', 'id');
$data['result'] = $this->datatables->generate();
$this->load->view('raw_ajax', $data);
} anyway, thanks a lot for your help and interest in this funny issue :) |
forgot to add, i've a lot of datatables with this exact syntax working like a charm in CI 2 with the original Ignited-Datatables library, what make me think the issue is probably in the library, maybe the todo : sRangeSeparator in the get_filtering function :) |
hi again, $( ctable.table().container() ).on( 'keyup', 'tfoot input', function () {
ctable.column.search( this.value ).draw();
}); instead of the one i have been using for quite a long time... and, curiously works fine when not server side well, back again to say i've been a little too enthusiatic, it keeps having problem, i keep digging... |
@virtualgadjo Figured something out with this. It could be cleaned up a lot, but this will allow you to use searchCols server side to define a column search alone or in combination with the default datatables search. I pass the $page_filter var via PHP to filter by order status. Hope this helps someone. In your javascript call:
` Amended Datatables.php get_filtering() method: `
` |
hello I'm sorry I'm using this version but I can't implement #129 this one, |
https://github.com/chland/Ignited-Datatables
Based on this class. It is faster than this library thanks to some optimisations. (10,000 serverside rows from ~2.5 seconds to ~1.2).
The text was updated successfully, but these errors were encountered: