Filter using an Select / Option dropdown
Filter using an Select / Option dropdown
Hi Guys,
This plugin is amazing!
I've been putting together a prototype listing here: http://www.wearehome.com/testape.php
It generates the table from an XML file via PHP at the moment.
I've searched on the forums and there are few articles about it, but not spefically..
I basically want to create Filter using an Select / Option dropdown?
ie .. they can pick between spain, turkey portugal etc....
Any help would be great... im going keep you all posted im trying to replace http://www.wearehome.com/plugplaynew_n/sliderchoosenew.php with a more functional tool .
current ones doesnt work very well. (which i didnt make)
This plugin is amazing!
I've been putting together a prototype listing here: http://www.wearehome.com/testape.php
It generates the table from an XML file via PHP at the moment.
I've searched on the forums and there are few articles about it, but not spefically..
I basically want to create Filter using an Select / Option dropdown?
ie .. they can pick between spain, turkey portugal etc....
Any help would be great... im going keep you all posted im trying to replace http://www.wearehome.com/plugplaynew_n/sliderchoosenew.php with a more functional tool .
current ones doesnt work very well. (which i didnt make)
This discussion has been closed.
Replies
Yup, using a select menu for a filter is most certainly possible - have a look at these posts:
http://datatables.net/forums/comments.php?DiscussionID=259
http://datatables.net/forums/comments.php?DiscussionID=460
which will help you in your quest!
Regards,
Allan
ok added a dropdown
heres the jquery:
[code]
$('#mytablex').dataTable( {
"iDisplayLength": 5,
"sPaginationType": "full_numbers",
"aoColumns": [
/* pic */ null,
/* Country */ null,
/* Dev */ null,
/* Type */ null,
/* Monthly price */ { "sType": "currency" },
/* Full price */ { "sType": "currency" }
]
} );
$('#whatever select').change(function() {
oTable = $('#mytablex').dataTable();
oTable.fnFilter( $(this).val() );
} );
[/code]
Problem is it duplicates the elements of the table ie .. next and so. mainly because im initializing the table again i think.
fixed
[code]$('#whatever select').change(function() {
goat = $(this).val();
if (goat == "All") {
//alert("All results");
oTable.fnFilter("");
oTable.fnDraw();
} else {
oTable.fnFilter(goat);
//alert(goat);
}
} ); [/code]
http://www.wearehome.com/testape.php
Trying to et my head round the price range finder
http://www.wearehome.com/testrane.php
Goin to create a slider that gets the price range as a next step!