Topic: Datatables Column Filtering

dwilbur priority asked 2 months ago


the functionality of MDB Datatables seems to be similar as what is provided by: https://datatables.net

so, is there a way to do the following?

Column Filtering


mlazaru staff answered 1 month ago


You were right about calling api, it can be done succesively.

When declaring columns make sure every column is an object:

{
  label: 'Age',
  field: 'age'
},

If you put just a string, the datatable will initialize, but search won't work. To show this case I've created 'age' column with this error so you could check that.

https://mdbootstrap.com/snippets/standard/mlazaru/4434814#js-tab-view


dwilbur priority answered 1 month ago


so i reconsidered looking at the referenced url about advanced search.

is there a way to do the following:

text1 in field1; text2 in field2; etc

?

or, maybe via javascript that calls the api for datables to do effectively that?

datatableInstance.search(phrase: String, column: String|Array (optional))

seems only to be able to state for 1 column, is there a way to do say...:

datatableInstance.search([
phrase1: String, column1: String|Array (optional),
phrase2: String, column2: String|Array (optional),
etc...
])

mlazaru staff answered 2 months ago


Hi,

Check out this example: https://mdbootstrap.com/docs/standard/data/datatables/#section-advanced-search

To find 'tiger' anywhere in the table type just 'tiger'. To find 'tiger' but only in 'name' column, type 'tiger in:name'.


dwilbur priority commented 2 months ago

that is considered a loss of functionality by the users of the existing system. also, the example doesn't seem to actually say is it just "and" queries? does phrase need to be quoted? to be honest, not all users are going to type column names correctly in a table that has say 20 columns... could we put this on a feature request? also, i will need to find a way to use datatables.net's datatables vs mdb's for the time being to resolve this. the one attempt of that i have done seems to break things.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • User: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 5.0.0
  • Device: na
  • Browser: na
  • OS: na
  • Provided sample code: No
  • Provided link: Yes