column.search filtering on blank value
column.search filtering on blank value
Sergey.Volchenkov@arris.com
Posts: 3Questions: 2Answers: 0
good day, i am using
column.search(val, true, false ).order( [[ 1, 'asc' ]] ).draw();
and in my column i have blank values and some strings. Could you recomend me how can i receive rows with blank values? Reason, when i send to value blank string, i am getting whole list, like unfiltered, but i wanna to have list where cells is blank... Do someone has ideas?
This discussion has been closed.
Answers
Maybe this might give you some suggestions? https://datatables.net/reference/api/filter()
In the examples, you can check for blank.
The
filter()
method doesn't actually change what is shown in the table is the thing, it filters the result set from an API call.column().search()
will change what is shown in the table, and you could use a regex to get only blank values:http://live.datatables.net/lehirela/1/edit
Allan
Allan,
column(0).search("", true, false ).order( 'desc' ).draw();
column(0).search('^$', true, false ).order( 'desc' ).draw();
providing exactly same result
if u have some idea, lease tell me
I'd need a link to a test case showing the issue please. The example I linked to above appears to show it working.
Allan
As Allan asked we need a running test case that shows the problem to help debug. this way we can see your data and the behavior of your code.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
The place to start is to make sure
if (val === "\\(Blank\\)")
is correct. You can put a console.log statement inside to make sure.search('^$', true, false)
is executing when you select(blank)
. I think the backslashes are causing the if statement to always befalse
. Its not a regex so they aren't needed to escape the parenthesis.Kevin
I have a similar issue to the abouve one, but I'm using bootstrap selectpicker.
How should I change the below code to manage the "(Blank)" string?
Its been asked multiple times to provide a test case showing the issue so we can help debug. Without seeing your specific data it wold be hard to guess what to change.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin