Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
120
findNodesByText does not find text with a single quote in it
posted

When a igTree node (version 2017.2) contains text with a single quote in it, the method 'findNodesByText' does not succeed in finding this node.  All other nodes that have no single quote are found successfully.

Example of a node:

<li class="ui-igtree-node ui-igtree-node-nochildren" data-path="23_0_3" data-value="" data-role="node"><a class="onfamilyclick ui-corner-all ui-state-hover ui-state-focus ui-state-active" href="/Catalogus/SearchGroupFam/?GroupNr=71&amp;FamNr=4&amp;Selection=0" style="background-color: rgb(226, 35, 26); color: rgb(255, 255, 255);">AIRCO'S</a></li>

code:

var textToFind = "AIRCO'S";

var nodesFound = $("#igTree").igTree("findNodesByText", textToFind);  <-- nodesFound.length is 0 !

I was able to trace it to the infragistics.ui.tree.js module where the following jquery 'find' command is executed (I have put some space between the quotes and double quotes for clarity):

parent.find(" li > a:contains(' " + text + " ')")

if I use switch the quotes/double quotes around, the node with the single quote is found:

parent.find(' li > a:contains(" ' + text + ' ")')

Is this a bug ?

  • 4315
    Offline posted

    Hi, Peter.

    I've made one error in the sample that I've sent you. I've used the wrong tree id and this was the reason to have incorrect result coming from the findNodesByText method. Here I have corrected it and you can see that the method is working correctly, even the search text is containing apostrophe. Can you modify it so that the problem you are talking is reproducible? Thank you in advance for the cooperation!

    Best regards,

    Nikolay Alipiev

    Software Developer

  • 4315
    Offline posted

    Hi, Peter.

    I've logged bug in our Ignite UI repo in GitHub. You can follow its progress and add comments. While the issue is fixed you can create your own function, which escapes the apostrophe symbol, before passing it as a parameter to the findNodesByText method.

    Best regards,

    Nikolay Alipiev

    Software Developer

  • 4315
    Offline posted

    Hi, Peter.

    Thank you for using our product!

    This seems to be a bug. I will ensure this true and will log it. Then I will update you with the bug number. Thank you!

    Best regards,

    Nikolay Alipiev