Individual column filtering with data from array doesn't work

Individual column filtering with data from array doesn't work

davedave9davedave9 Posts: 3Questions: 1Answers: 0
edited August 2018 in Free community support

Hello,

I'm trying to get individual column filtering working on a table that uses an array as data.

This is my code
$('#table').DataTable( {
"lengthMenu": [10, 25, 50, "All"],
responsive: true,
dom: 'Blfrtip',
buttons: [],
data: range.values, // this is the array with data
columns: [
{ title: header[0] },
{ title: header[1] },
{ title: header[2] },
{ title: header[3] },
{ title: header[4] },
{ title: header[5] },
{ title: header[6] }
]
} );

I've tried this
https://www.jqueryscript.net/demo/DataTables-Jquery-Table-Plugin/examples/api/multi_filter_select.html

Nothing works, can anyone help?

Answers

  • kthorngrenkthorngren Posts: 20,147Questions: 26Answers: 4,736

    Nothing works, can anyone help?

    Can you be more specific and describe the actual problem?

    I'm trying to get individual column filtering working on a table that uses an array as data.

    You are not showing any of the code for this.

    Maybe you can post a test case with an example of what would be in the header and range.values variables. This way we have your specific information to help.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • davedave9davedave9 Posts: 3Questions: 1Answers: 0

    The header is an array with the table headings.
    And the range.values is a 2d array with the table contents

  • davedave9davedave9 Posts: 3Questions: 1Answers: 0

    The table works with this code, the problem is that the filtering for individual columns doesn't work

  • colincolin Posts: 15,118Questions: 1Answers: 2,583

    Hi @davedave9 ,

    Your code, that you posted above, doesn't construct a dropdown like the page you linked to, nor does it attempt to do any searching. That example you posted is a good one, so I'd suggest using that as a template.

    If still no joy, we're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.