[Dojo-interest] dijit.Tree - icons and +/- signed are not visible

0 views
Skip to first unread message

roman.yakovenko

unread,
Aug 23, 2010, 3:29:07 PM8/23/10
to dojo-i...@mail.dojotoolkit.org

Hello.

I am using Dojo 1.5 and for some reasons dijit.Tree icons and +/- signs are
not visible on Windows7 (64bit) IE8 and Chrome.

If I click on the area, where the icon or signs should be, then the +/-
signs become visible, icon is still invisible.

(The same code/application works fine on Ubuntu 10.04 - Chromium browser)

The following code is used to draw tree:

<script type="text/javascript">
var rawdata = [
{
id: '1',
label: '1',
directory: true,
url: '1',
children:[
{
id: '1.1',
label: '1.1',
directory: true,
url: '1.1',
children:[
{
id: '1.1.1',
label: '1.1.1',
directory: true,
url: '1.1.1',
children:[
{
id: '1.1.1.1',
label: '1.1.1.1',
url: '1.1.1.1'
}
]
}
]
}
]
}
];


function onTreeClick(event,item){
location=item.item.url[0]
}

function GetIconClass(item, opened){
if ( item.root == true )
{
return ""
}
else
{
if ( item == "undefined" )
{
return ""
}
else
{
return item.directory ? (opened ? "dijitFolderOpened" :
"dijitFolderClosed") : "dijitLeaf";
}
}
}


function prepare() {
var store = new dojo.data.ItemFileReadStore({
data: {
identifier: 'id',
label: 'label',
items: rawdata
}
});

var treeModel = new dijit.tree.ForestStoreModel({store: store});
var treeControl = new dijit.Tree({
model: treeModel,
showRoot: false,
getIconClass: GetIconClass,
_createTreeNode: function(args) {
var tnode = new dijit._TreeNode(args);
tnode.labelNode.innerHTML = args.label;
return tnode;
}
},
"mytree");
dojo.connect(treeControl, "onClick", onTreeClick);
}

dojo.addOnLoad(prepare);
</script>

<div id="mytree"></div>


Settings getIconClass handler to a custom function or leaving the default
implementation doesn't help.


Any help is greatly appreciated.
Thank you.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dijit-Tree-icons-and-signed-are-not-visible-tp1298176p1298176.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
Dojo-i...@mail.dojotoolkit.org
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Karl Tiedt

unread,
Aug 23, 2010, 4:12:20 PM8/23/10
to dojo-i...@mail.dojotoolkit.org
Do the test cases here:
http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/ work in
your browser? If so then it may be an issue with how you implemented
your code (possibly broke or overiding something dijit.Tree neded)

-Karl Tiedt

roman.yakovenko

unread,
Aug 23, 2010, 5:20:53 PM8/23/10
to dojo-i...@mail.dojotoolkit.org

Both examples(
http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/test_Tree.html
and
http://archive.dojotoolkit.org/nightly/checkout/dijit/tests/test_Tree_Notification_API_Support.html
) are working fine.

Unfortunately, I don't have any knowledge about JS. I tried to create a
small example, which reproduce the problem:

<script type="text/javascript">
var rawdata = [
{
id: '1',
label: '1',
directory: true,
url: '1',
children:[
{
id: '1.1',
label: '1.1',
directory: true,
url: '1.1',
}

]
}
];


function onTreeClick(event,item){
location=item.item.url[0]
}


function prepare() {
var store = new dojo.data.ItemFileReadStore({
data: {
identifier: 'id',
label: 'label',
items: rawdata
}
});

var treeModel = new dijit.tree.ForestStoreModel({store: store});
var treeControl = new dijit.Tree({
model: treeModel,
showRoot: false

},
"mytree");
dojo.connect(treeControl, "onClick", onTreeClick);
}

dojo.addOnLoad(prepare);
</script>

I found a few differences ( redefined getIconClass function) but this didn't
helped.
Do you see something I did wrong? If not, do you have an idea what I should
touch/configure?

Thanks for help.


P.S. I am using "Dojo Toolkit Release" and placed it as is ( extracted)
under the web server.
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dijit-Tree-icons-and-signed-are-not-visible-tp1298176p1300467.html


Sent from the Dojo Toolkit mailing list archive at Nabble.com.

sturei

unread,
Sep 26, 2010, 6:12:25 AM9/26/10
to dojo-i...@mail.dojotoolkit.org

Depending on where you put the dojo folders, it may be that dojo can't find
the stylesheet or the images. Take a look at the
http://docs.dojocampus.org/dijit/Tree-examples#example-using-local-data-and-markup
tree examples , particularly the line


<link rel="stylesheet" type="text/css"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css">


The example gets the stylesheet from dojo on the web. Alternatively, if you
have a local copy in a sub-folder "js", for example, you could use


<link rel="stylesheet" type="text/css"
href="js/dijit/themes/claro/claro.css">


--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dijit-Tree-icons-and-signed-are-not-visible-tp1298176p1582860.html

Reply all
Reply to author
Forward
0 new messages