Range Filter Multi-Columns

Range Filter Multi-Columns

Massimo1974Massimo1974 Posts: 27Questions: 2Answers: 0

I have many columns with the min and max filter how can I handle it? can i have a single function?
http://live.datatables.net/cehucowi/1/edit

Replies

  • kthorngrenkthorngren Posts: 20,293Questions: 26Answers: 4,768

    Thanks for the test case!

    The id in HTML needs to be unique. The Salary search inputs will need a different id. You will need to create search plugins for each column since they are searching different data columns and types of data. Here is an updated example:
    http://live.datatables.net/gereqoxa/1/edit

    Kevin

  • Massimo1974Massimo1974 Posts: 27Questions: 2Answers: 0

    sorry but if I have 15 columns where to do the research I have to put the function for each column ??? or can you have one?

  • kthorngrenkthorngren Posts: 20,293Questions: 26Answers: 4,768
    edited March 2019

    I have to put the function for each column ??? or can you have one?

    You could use one function. Within the function you specify which data to look at, for example:
    var age = parseFloat( data[3] ) || 0; // use data for the age column

    You can access the data from multiple columns and compare them in any way you want. You can create OR type searches this way. You just need to write the Javascript to perform the comparisons you want.

    It goes row by row through the data. Ultimately you need to return true or false for each row. The number of functions you create is determined by how you want them to behave.

    Kevin

This discussion has been closed.