Custom Filtering with Exact Match

Custom Filtering with Exact Match

lorenzoatlorenzoat Posts: 3Questions: 0Answers: 0
edited May 2011 in General
Dear all,

I am trying to have a drop-down list in order to do custom column filtering.

But, I can not obtaing an exact filter match. i.e. "1" is "1" no "11" or "21" or "1x" or "x1"

You can check my tables in this url: http://www.rlmm.org/ojs-files/library.php

Can you help how to modify my existing code?

Regards,

Replies

  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    edited May 2011
    hi lorenzoat,

    you need to add extra regular expression in your string...try this...i am sure it will help you.. don't forget to disable regx in filter function.
    [code]
    valueNeedtoFilter = "^\\s*"+data+"\\s*$";
    oTable.fnFilter(valueNeedtoFilter ,iColumn,false,);
    [/code]
    You can see this post also...http://datatables.net/forums/comments.php?DiscussionID=4096&page=1#Item_5
    Thanks,
    Vivek
  • jessefranklingjessefrankling Posts: 3Questions: 0Answers: 0
    edited June 2011
    BN
  • jessefranklingjessefrankling Posts: 3Questions: 0Answers: 0
    the correct format and values for exact match are

    [code]
    sortby = "^\\s*"+data+"\\s*$";
    oTable.fnFilter(sortby, iColumn, true);
    [/code]
  • rajeshArajeshA Posts: 4Questions: 0Answers: 0
    exact match is not working
    This is my code
    $("#fromDate").change( function () {
    var oSettings = oTable.fnSettings();
    oSettings.aoPreSearchCols[ 3 ].bRegex = false;
    oSettings.aoPreSearchCols[ 3 ].bSmart= false;
    var valueNeedtoFilter = "^\\s*"+this.value+"\\s*$";
    oTable.fnFilter( valueNeedtoFilter, $(".filters th input").index(this),true);
    } );
    Any one help me
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Drop the white space matching - it shouldn't be needed with individual column filtering.

    Allan
  • rajeshArajeshA Posts: 4Questions: 0Answers: 0
    i didn't understand, can you explain little bit more, it will helpful for me
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    You've got white space matching in your variable valueNeedtoFilter that you use to filter the column. I would suggest (unless you specifically put white space in the data for the columns) that you need to remove that.

    Allan
  • rajeshArajeshA Posts: 4Questions: 0Answers: 0
    Thanks for your reply.

    I have the following values in table
    Jul 15, 2012
    Jul 5, 2012
    Using Date calendar am display Jul 5, 2012. It's displaying two values. am used the above posted code only.
  • rajeshArajeshA Posts: 4Questions: 0Answers: 0
    Am changed lot of way, but still unable to get exact matching result. Any one help me to fix this issue
This discussion has been closed.