jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree Accessing Session variables within Jquery code

Tagged: , ,

This topic contains 6 replies, has 2 voices, and was last updated by  kkasunperera 12 years, 8 months ago.

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

  • kkasunperera
    Member

    I’m using jqxTree with checkboxes and trying to access session variables withing Jquery code. Here is my code. When I access session variables withing the code as below it just show the tree structure on the web page but without checkboxes or “jqxTree” styles. What could be the problem?

    $(document).ready(function () {
    // Create jqxTree
    var theme = getTheme();
    // create jqxTree
    $('#jqxTree').jqxTree({ height: '400px', hasThreeStates: true, checkboxes: true, width: '230px', theme: theme });
    $('#jqxCheckBox').jqxCheckBox({ width: '200px', height: '25px', checked: true, theme: theme });
    $('#jqxCheckBox').bind('change', function (event) {
    var checked = event.args.checked;
    $('#jqxTree').jqxTree({ hasThreeStates: checked });
    });
    $("#jqxTree").jqxTree('selectItem', $("#home")[0]);

    //display doc sections content at the click event
    <%HashMap contentMap=(HashMap)request.getSession().getAttribute("docSecContentMap"); %>
    $('#jqxTree').bind('select', function (event) {
    var args = event.args;
    var item = $('#jqxTree').jqxTree('getItem', args.element);
    var docSections=;

    document.getElementById('td1').value = docSections[item.value];

    });

    });


    Dimitar
    Participant

    Hello kkasunperera,

    Please make sure you have included the following files in your page: jqx.base.css and gettheme.js.

    Best Regards,
    Dimitar

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


    kkasunperera
    Member

    Hi Dimiter

    Yes I have jqx.base.css and gettheme.js in my page.
    Here is modified code but still no success.

    http://pastebin.com/XvyhhVmD

    (@Admins-There is something wrong with the text editor that you have provided with this forum, I cant post my code correcly)


    Dimitar
    Participant

    Hi kkasunperera,

    Can you please try your example without the HashMap portion of your code and tell us if the issue persist? It may have something to do with inappropriate position of the

    <% %>

    tags.

    As for displaying HTML code properly, please refer to this topic.

    Best Regards,
    Dimitar

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


    kkasunperera
    Member

    Hi Dimitar

    The jqxtree works fine without this part of the code

    http://pastebin.com/k6jYi6B5

    So I think problem is with the putting values to the “docSections” variable
    ———————————————————————————————————-

    Keeping this line dosen’t have any problem
    <%HashMap contentMap=(HashMap)request.getSession().getAttribute(“docSecContentMap”); %>


    kkasunperera
    Member

    Hi Dimitar
    FYI with this kind of code jqxTree works fine.

    http://pastebin.com/sZGaZ42q

    Accessing Session variables within Jquery code #8228

    kkasunperera
    Member

    Hi Dimitar

    Problem solved.
    My hashmap was this HashMap. The string element containd \” characters double quotations marks. That caused the problem. I have removed /” elements from the string and it works fine.

    Thanks for spending your time to answer my questions.

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

You must be logged in to reply to this topic.