Search: sort by multiple values in single column?

Search: sort by multiple values in single column?

rxngrxng Posts: 2Questions: 0Answers: 0

Hi

I am trying to search within a column "Acts" that has multiple tags with associated values. E.g. organise:6 converse:3 explore:2

There are about 20 tags in a column so not feasible to have one column per tag. When searching "explore" in that "Acts" column, how can we sort by users that have the highest score for explore?

Thanks

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @rxng,

    You can use regular expressions to search for multiple values, for example:

      table.column(2).search('(London|Edinburgh)', true, false).draw();
    

    See example here,

    Cheers,

    Colin

  • rxngrxng Posts: 2Questions: 0Answers: 0

    Hi

    Thanks for your reply, my question was how do you search and sort by the values that those words have?

    For example, User 1 has "London" with a value of 3

    User 2 has "London" with a value of 5

    A search for "London" should then sort with User 2 showing on top of User 1

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @rxng ,

    You could use columns.render to modify the string that is return for searches and sorts - there a few examples on that page. I don't fully understand the problem, so that option above doesn't help, it would be worth creating a 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.