Dynamically Populate Type : "select" for column filter
Dynamically Populate Type : "select" for column filter
Hi
I wanted to know if there is any way to dynamically populate the column filter for "select" type for all the unique values in the column.
Right now , I am manually entering the values of the dropdownbox . i.e : Gecko,Trident,KHTML etc.
Code is :
[code]
$(document).ready(function () {
$("#the_table").dataTable().columnFilter({
"aoColumns": [
{ type: "select", values: ['Gecko', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman'] },
{ "type": "text" },
{ "type": "text" },
]
}
);
});
[/code]
There are many cases where there would be varying values of the column and in that case , I would have to change the code eveytime.
I wanted to know if there is any way to dynamically populate the column filter for "select" type for all the unique values in the column.
Right now , I am manually entering the values of the dropdownbox . i.e : Gecko,Trident,KHTML etc.
Code is :
[code]
$(document).ready(function () {
$("#the_table").dataTable().columnFilter({
"aoColumns": [
{ type: "select", values: ['Gecko', 'Trident', 'KHTML', 'Misc', 'Presto', 'Webkit', 'Tasman'] },
{ "type": "text" },
{ "type": "text" },
]
}
);
});
[/code]
There are many cases where there would be varying values of the column and in that case , I would have to change the code eveytime.
This discussion has been closed.
Replies
You may want to consider using mDataProp or fnRender
Here is an example on mDataProp as it is more flexible to work with and it gives you more options
http://datatables.net/blog/Orthogonal_data
so when the type is display you can do whatever you want there
Hope that helps