jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Tree › Accessing Session variables within Jquery code
This topic contains 6 replies, has 2 voices, and was last updated by kkasunperera 12 years, 8 months ago.
-
Author
-
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];
});
});
Hello kkasunperera,
Please make sure you have included the following files in your page: jqx.base.css and gettheme.js.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimiter
Yes I have jqx.base.css and gettheme.js in my page.
Here is modified code but still no success.(@Admins-There is something wrong with the text editor that you have provided with this forum, I cant post my code correcly)
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,
DimitarjQWidgets team
http://www.jqwidgets.com/Hi Dimitar
The jqxtree works fine without this part of the code
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”); %>Hi Dimitar
FYI with this kind of code jqxTree works fine.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.
-
AuthorPosts
You must be logged in to reply to this topic.