Custom Filter of Data Tables using CRUDS
Custom Filter of Data Tables using CRUDS
murthy85716
Posts: 4Questions: 0Answers: 0
Hi I am using data Tables for the first time. The data Table which i need to use is added as a partial view. All the screens which need a data table will add the partial view. My requirement is on load of the screen i need to populate the data table with data from db. I have done that. Now there is a button on the view on clicking it CRUD will open where it has the fields needed for filtering. Now user specifies the filter criteria and clicks the button present on the CRUD. Now my data table need to get populated with new set of filtered data.
I am able to get the filtered data from the DB in form of JSON . Data is in the form of array of arrays. Now I want to bind this data to the data table. Can you show me how can i do that. Do give me an example with description if the input parameters, as I am much confused with them.
Thanks in advance.
I am able to get the filtered data from the DB in form of JSON . Data is in the form of array of arrays. Now I want to bind this data to the data table. Can you show me how can i do that. Do give me an example with description if the input parameters, as I am much confused with them.
Thanks in advance.
This discussion has been closed.
Replies
var stateSelectedValue = $('#StateDropdown').val();
var bankSelectedValue = $('#BranchTypesDropdown').val();
var serviceSelectedValue = $('#ServiceTypesDropdown').val();
var statusSelectedValue = $('#StatusTypesDropdown').val();
var strtDate = $('#StartDate').val();
var strtDate = $('#EndDate').val();
if (stateSelectedValue != 0 || bankSelectedValue != 0 || serviceSelectedValue != 0 || statusSelectedValue || strtDate.length != 0 || EndDate.length != 0)
{
var oTable = $('#DataList').dataTable();
var oSettings = oTable.fnSettings();
oTable.fnFilter('', 1);
oTable.fnFilter('', 2);
oTable.fnFilter('', 3);
oTable.fnFilter('', 6);
oTable.fnFilter('');
if (stateSelectedValue != 0)
oTable.fnFilter(stateSelectedValue, 1);
if (bankSelectedValue != 0)
oTable.fnFilter(bankSelectedValue, 2);
if (serviceSelectedValue != 0)
oTable.fnFilter(serviceSelectedValue, 3);
if (statusSelectedValue != 0)
oTable.fnFilter(statusSelectedValue, 6);
oTable.fnDraw();