Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82565

Filtering each column programmatically

$
0
0

Hi! To begin, I want to thank you for your beautiful plugin, such great work!

In my current DataTables setup, I can show/hide columns (ColVis), reorder them, sort them.

I even coded a "scenario" function that does changes to the table according to the "data-*" attributes of the element clicked.

See this example of a scenario configuration to have an idea of what I'm talking about :

<li data-colums-show="0,1,2,3" data-colums-hide="4,5,6,7,8,9" data-columns-order="9,8,7,6,5,4,3,2,1,0" data-columns-sort-asc="0,1,2" data-columns-sort-desc="3"><a role="menuitem" href="#">Scenario 1</a></li>

Now what I would like to add, is the possibility when loading a scenario, to only show the rows where (for example) the value of a specific column is greater than 20, or another column is lower than 70%.

I have tried to use "fnFilter" but the function parameter is a string, so I can't compare the values : greater than / lower than. I have tried "$.fn.dataTable.ext.search.push" and returning a boolean : This works but is not column specific + when the order of the columns changes, I cannot find the right data to compare anymore. data[n] does not contain the same values as before sorting anymore, unfortunately.

Do you have any ideas that could help me implement this functionality?

If can't show you the table right now. I'll try to make a basic example if we don't manage to find any directions or functions to use.

Thanks in advance for your help Tim


Viewing all articles
Browse latest Browse all 82565

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>