jQWidgets Forums

jQuery UI Widgets Forums Grid applying different libraries after jQXGrid onclick

This topic contains 1 reply, has 2 voices, and was last updated by  Ivo Zhulev 8 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • walker1234
    Participant

    Please find this JSfiddle which basically works without using Rangy library. I am not using this JSfiddle approach for my application and hence trying to apply rangy library in the JSfiddle as shown below:

    `rangy.init();
    highlighter = rangy.createHighlighter();
    highlighter.addClassApplier(rangy.createClassApplier(“highlight”));
    function highlight(){
    highlighter.highlightSelection(‘highlight’);
    var selTxt = rangy.getSelection();
    console.log(‘selTxt: ‘+selTxt);
    rangy.getSelection().removeAllRanges();
    }
    function removeHighlights() {
    highlighter.removeAllHighlights();
    }

    document.getElementById(‘docContentPanel’).addEventListener(‘click’, highlight);`

    Now in this JSFiddle, I am trying to use Rangy, referring to one of the online code demonstrating Rangy usage here. I am wondering what would go in place of document.getElementById('docContentPanel').addEventListener('click', highlight); because I am already inside click handler and I am highlighting words when a user clicks on a particular cell.

    P.S: I am using raw links from github for adding rangy libraries and JSfiddle is refusing to accept the scripts as strict MIME type is enabled by the author. So, second JSFiddle with Rangy library may not run for you in JSFiddle.


    Ivo Zhulev
    Participant

    Hi walker1234,

    I havent used Rangy before but as far as i understand you are inside of the click handler (if looking the rangy example, we are inside the highlight document.getElementById('docContentPanel').addEventListener('click', highlight); function. So in your click handler just do all the things that are done in the highlight function.
    Hope I helped.

    Best Regards,
    Ivo

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.