"anchored" filter

Questions"anchored" filter
Jim Bell asked 8 years ago

For text columns, if I enter text in the filter box for that column, I get a match on the entered text if the text if anywhere in the data for that column. For example

Row 1 data…
This is a test.

Row 2 data
Testing of the second row.

When I enter the term "test" in the filter box, I see both rows since they both contain the term "test". Is there a way to "anchor" the search term to the beginning of the line? So that entering the term "test" (or whatever anchors the search term) in the filter would display only the row(s) that begin with test. This is like using the "%" in the sql function "like".

1 Answers
Abu Ghufran answered 8 years ago

You can edit lib/inc/jqgrid_dist.php and replace cn with bw (begins with)

jQuery("#<?php echo $grid_id?>").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'cn'});

with:

jQuery("#<?php echo $grid_id?>").jqGrid('filterToolbar',{stringResult: true,searchOnEnter : false, defaultSearch:'bw'});

Your Answer

17 + 20 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?