0

i did a descendant tree for an entity in my app, using the libray jstree. I do what is usual to use it:

  • show an <ul> & <li> structure as usual
  • then i apply the .jstree(...) function to the parent <div> of the structure.

I'm sorry but i can't provide you my source code because is dynamically generated from diferent parts of the app, but i can show a result example of the <ul>&<li> structure:

<div id="unidadtree">
<ul>
    <li id=182 ><a href="-censored-">Node-name</a></li>
    <li id=170 ><a href="-censored-">Node2-name</a>
        <ul>
            <li id=179 ><a href="-censored-">Node2.1-name</a></li>
            <li id=171 ><a href="-censored-">Node2.2-name</a>
                <ul>
                    <li id=172 ><a href="-consored-">Node2.2.1-name</a></li>
                </ul>
            </li>
            <li id=176 ><a href="-censored-">Node2.3-name</a>
                <ul>
                    <li id=178 ><a href="-censored-">Node2.3.1-name</a></li>
                    <li id=177 ><a href="-censored-">Node2.3.2-name</a></li>
                </ul>
            </li>
            <li id=175 ><a href="-censored-">Node2.4-name</a>
                <ul>
                    <li id=33 ><a href="-censored-">Node2.4.1-name</a>
                        <ul>
                            <li id=137 ><a href="-censored-">Node2.4.1.1</a></li>
                        </ul>
                     </li>
                </ul>
            </li>
        </ul>
    </li>
</ul>
</div>

then the js function converting that list into a jstree is:

`

$("#unidadtree").jstree({
    "themes" : {
        "theme" : "custom",
        "dots" : false,
        "icons" : true,
    }
});`

The problem is that, few times (about 1 of each 50 times) the javascript function seems to not load properly. The result that i see is a normal html <ul> & <li> structue. The really strange issue is the low frequency of the error. Could be not my fault? Is someone else having this problem?

thank you very much for your time! :D

Andreu Ramos
  • 2,758
  • 2
  • 22
  • 35

1 Answers1

2

It could be because your ID attributes are invalid. In HTML, you should not have all-numeric values for ID. See this post: What are valid values for the id attribute in HTML?

Also, the ID's should be surrounded by quotes within the source.

I have experienced cases where all-numeric ID's like you have, have led to unexpected results in some browsers.

Community
  • 1
  • 1
Dave L.
  • 8,707
  • 7
  • 39
  • 64
  • well, i changed it and it seems to work fine, but i can't be sure the problem will not appear again >_<. a="" as="" assume="" everything="" fine="" goes="" i="" if="" in="" it="" much="" solved.="" thank="" very="" week="" you=""> – Andreu Ramos Nov 24 '11 at 16:11