Hoping someone could help me here…as I’ve been struggling for sometime.sigh
So long story short is I have a page using the EDataTables( "–www.yiiframework.com/extension/edatatables/–" ) which is the Yii extension for the JQuery data table: "–www.datatables.net/–" . My table works and looks great, but my problem is manipulating ANYTHING after the widget gets created.
All I want is to ‘imitate’ the ‘search’ functionality currently there with my custom html select box(or intergrated/created from table widget). Typically I want to display data in the table based on what ‘billing date’ you select in the dropdown. I technically have 2 dropdowns, but I just want the one to work for now. The billing_date field is also in the same table as all the others…no joins.
Once again, any jquery I use to add features or change them…just DOES NOT WANT TO WORK!
i.e /* var table = $(’#DataTables_Table_0’).DataTable();
$("#DataTables_Table_0 tfoot th").each( function ( i ) {
var select = $('<select><option value=""></option></select>')
.appendTo( $(this).empty() )
.on( 'change', function () {
table.column( i )
.search( $(this).val() )
.draw();
} );
table.column( i ).data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
*/
So I’ve attached my image of what it looks like to give a clearer understanding. But in a nutshell, I want something like this: “–www.datatables.net/release-datatables/examples/api/multi_filter_select.html–” .
I want a dropdown with all billing dates as options in my table, so I can filter them with the selected option. This will naturally update the table.
My Current setup:
Monthend.php - model
MainController.php - controller
index.php - view
billing.js - within view loaded as: Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.’/js/billing.js’,CClientScript::POS_END); above where widget is initialized in view. – $widget->run();
If anyone can assist me with this, I will be really grateful!
Have you got any solution? I would also like to add column filter in edatatables, but unfortunately not found any solutions. Please share with us if you found same.