add menu items into jquery datatables
I have a filter I added to a datatable (jquery datatable) which worked perfectly until I figured out how to add it to the header.
I originally handled is like so:
$('select#booking_status').change( function() { oTable.fnFilter( $(this).val() ); } );
Which worked until I added the select menu inside the header with the sDom feature
"sDom": '<开发者_StackOverflow社区"H"<"tools">lfr>t<"F"ip>'
I'm also not sure on the last part, but I couldn't seem to get it to work where it was until i followed the example and wrapped the select like so...
$("div.tools").html('Organize by: <select id="booking_status"><option value="">All Bookings</option><option value="confirmed">Upcoming</option><option value="arrived">Arrived</option><option value="rejected">Rejected</option></select>');
It was initially just in the div outside the table.
http://www.datatables.net/examples/advanced_init/dom_toolbar.html
精彩评论