filtering problem

filtering problem

28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
edited August 2010 in Bug reports
hi Allan.
first of all thanks for such a great plug in.
i am using dataTable1.6.2

Actually i am using individual column functionality of dataTable and my code is
[code]oTable.fnFilter([container],iColumn,false);[/code]
where, as you know
container is input parameter(input string) and iColumn is column no on which i am apllying this filter function to filter the Table.its working fine for all input except if its like
Look & Feel
if i am giving input string like this, then table is not getting filtered.
i think its because of '&'.
so i tried to escape this but problem not get solved.

so please let me know if there is any solution for this or if Somewhere i am wrong

thanks in advance
vivek

Replies

  • allanallan Posts: 63,405Questions: 1Answers: 10,452 Site admin
    If you type 'Look & Feel' does that match? There was an issue with this a while back, but I thought it was fixed. Indeed I've just tried it and it seems to be fine. Perhaps try 1.7.0 and see if that addresses it (although I think the fix was before that). If not, perhaps you can post an example showing the problem please?

    Allan
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    Hi Allan
    Thanks for reply.

    No,its not but there is same value in table.
    As you said this has been fixed,i searched a lot but i didn't get that discussion.
    So if its possible can you post that discussion url.
    I tried this with 1.7.0 but i got another problem i passed my input string in fallowing three conditions
    1- only bSmart is enabled,i got the results as expected but when i passed multivalued input string, for exmp
    Look & Feel|cosmos|program
    its not getting filtered,output comes "No Match's found"
    2-only bRegx is enabled,it gives result for multivalued string but not for input like"Look & Feel"
    3-when both bRegx and bSmart enabled,i got result "No Match's found" if i passed input "Look & Feel" or "Look & Feel|cosmos|program"
    but i got results for other type of inputs.
    Sorry i can't post any example because i am in development phase of my projecet,but you can refer your example
    http://datatables.net/beta/1.7/examples/api/regex.html
    by changing second column value Firefox 1.0 to "Firefox 1.0 & Firefox 1.5" and tries this with all three condition as i stated before.
    again sorry for your inconvenience but really i am stucked here.
    please help me .

    thanks in advance
    Vivek
  • allanallan Posts: 63,405Questions: 1Answers: 10,452 Site admin
    I should have been fixed in 1.7 beta 3 - from the release notes: Fixed: HTML entities in text could cause filtering to return incorrect results. Here is the discussion that related to the fix: http://datatables.net/forums/comments.php?DiscussionID=2094 . Does "Look & amp; Feel" match (without the space before the 'amp;'?

    Allan
  • 28.vivek.s28.vivek.s Posts: 69Questions: 0Answers: 0
    edited August 2010
    Thanks Allan
    yes its worked.i simply coded like this
    [code]
    function submitData(str,iColumn)
    {
    jQuery("#"+str+" :checked").each(function() {
    if(container.length==0){
    container = "^"+jQuery(this).val().LTrim();

    }
    else{
    container += "|" +"^"+jQuery(this).val().LTrim();
    }
    });
    if(container.length>0){
    oTable.fnFilter([container],iColumn,false);
    }
    else{
    oTable.fnFilter('',iColumn,false);
    }
    container = ""
    }

    String.prototype.LTrim = function()
    {
    return this.replace(/(^\s*)/g, "").replace(/\&/g,'&a_m_p;');
    }
    [/code]

    here i am checking that checkbox is checked r not if yes then just called LTrim to replace '&' by '&a_m_p;', and after that passing it to fnFilter as a input parameter.(remove _ while you are doing actual code)

    Vivek
This discussion has been closed.