jquery - Datatables column filter checkbox not working with Ajax -
when bind datatables ajax datatables column filter checkbox disappear. here code
$('#table1').datatable({ "ajaxsource": "js/group.json" }).columnfilter({ splaceholder: "head:after", aocolumns: [ { type: "checkbox", values: null }, { type: "checkbox", values: null }, { type: "checkbox", values: null }, { type: "checkbox", values: null }, { type: "checkbox", values: null }, { type: "checkbox", values: null } ] });
without knowing going on - know comment "it not working when data ajax" - , therefore assuming else working great, no news news etc; , taken notice of columnfilter
being old buggy plugin built datatables 1.9.x +100 open issues, last fix 1½ year ago - simple matter of javascript asynchronicity.
when using chaining
$('#table1').datatable({ //some ajax stuff }).columnfilter({ .. })
then columnfilter({ .. })
executed immediately, not wait until ajax has finished business. result there no data loaded @ time of columnfilter
initialisation. prevent this, initialise columnfilter
in callback :
$('#table1').datatable({ fninitcomplete : function() { this.columnfilter({ splaceholder: "head:after", ... }) } })
Comments
Post a Comment