Partial load the data to create table
Partial load the data to create table
Hi mates,
I'm using below to create table
table_2 = $('#TargetCompanyCounterParty').DataTable( {
"ajax": {
"url": "./Python/Output/Nodes/Level_3/" + vTargetCompany + ".json",
"dataSrc": ""
},
"columns": [
{ "data": "id" },
{ "data": "type" },
{ "data": "gender" }
],
"lengthMenu": [[5, 25, 50, -1], [5, 25, 50, "All"]],
"pageLength": 5,
columnDefs: [
{ width: 330, targets: 0 }
],
fixedColumns: true
} );
How can I load the subset of this data? For example let's say gender == 'Male'. I try to search it in forum however it's no luck.
Thanks in advance!
This discussion has been closed.
Answers
We can use this approach, however it's global search. And I don't want it to show in search box.
"search": {
"search": "Male"
}
You can use
ajax.datato send a search term to the server via theajaxrequest. This will allow you to return just the data of interest.You can hide the global search input using the
domoption. If you want a global search input you can create your own and create an event handler to usesearch()to search for the input.Kevin
Thanks kthorngren. Learnt a lot!~
Finally I solved it using this approach, it searchs the column without text in search box.
"searchCols": [
null,
null,
{ "search": "WWM" },
null
]
There is that option too
Kevin