Select Filtering
Select Filtering
I am trying to implement this (http://live.datatables.net/xehimatu/1/edit) into my code. I have moved my selects off the table and am only showing 3 of them. But nothing I do seems to work. I am not a really good coder.
This what I do during initialization:
initComplete: function () {
this.api().columns().every( function (index) {
var column = this;
var label
var select = $('<select><option value=""></option></select></br>')
.appendTo( $('#sel_area'))
.on( 'change', function () {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search( val ? '^'+val+'$' : '', true, false )
.draw();
} );
column.data().unique().sort().each( function ( d, j ) {
select.append( '<option value="'+d+'">'+d+'</option>' )
} );
} );
$("#sel_area :input:gt(2)").remove();
$("#sel_area br:gt(2)").remove();
$("select").each(function(index){
$(this).before("<label>"+sellabels[index]);
$(this).after("</label>");
});
},
Anyone know what I'm doing wrong?
This question has an accepted answers - jump to answer
Answers
I should also add that just about everything I've done gets me the 'table.column is not a function' stuff
You can also try my yadcf plugin for datatables, see showcase