This is a migrated thread and some comments may be shown as answers.

prevent id change on node selection

3 Answers 91 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Gaetano
Top achievements
Rank 1
Gaetano asked on 20 Feb 2013, 10:22 AM
Hi, 
I found that kendo treeview automatically change  the id of a node when selecting that node..

example:
<ul class="k-group" style="">
    <li id="idItem1" class="k-item" data-uid="f15ccb0c-f3d8-4a56-bebd-e9d14d2dc877" role="treeitem">
        <div class="k-top">
            <span class="k-icon k-plus"></span>
            <span class="k-in">
                <span class="k-sprite folder"></span>Item1
            </span>
        </div>
        <ul class="k-group" style="display: none;">
            <li class="customClass k-item k-last" id="CustomId" data-uid="f244d97f-2adb-4e49-b40a-3766dd1eba92" role="treeitem">
                <div class="k-bot">
                    <span class="k-in">
                        <span class="k-sprite pdf"></span>Sub-Item1
                    </span>
                </div>
            </li>
        </ul>
    </li>
    <li id="idItem2" class="k-item" data-uid="8da3519c-27cd-49e6-a478-6e4cf1ccd3d0" role="treeitem">
        <div class="k-mid">
            <span class="k-in">
                <span class="k-sprite folder"></span>Item2
            </span>
        </div>
    </li>
</ul>
this is the default state; then if i select a node, its id change into

id="treeName_tv_active"
and once i select another node, its became just an empty field..

now, I saw that seems to be the "design" behavior for this control...
the problem is that if I can't get the Id of the node (I use this treeview to filter a listView and its pager).

I personally think that change the id of node is not a good behavior...I usually see some added classes to manage control's states...
Is there anyway of preventing this behavior?

Thanks
Fabio

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 21 Feb 2013, 05:09 PM
Hello Fabio,

You are right that the "treeName_tv_active" id is set to the selected items of the TreeView, but only if there is no user specified id for the current list item. I prepared the following JS Bin Example to demonstrate this. Notice how the "treeview_tv_active" id is set on every selected node, except the ones, where I have my custom id.
 

Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Gaetano
Top achievements
Rank 1
answered on 22 Feb 2013, 09:43 AM
Hi Dimiter,
ok, I tried your example and it works fine..so I tried with my own tree and surprisingly It worked too...
I checked my version of kendo.all.js and it's v2012.3.1114, while I imagine you used the last one...
Could it be that this issue was present in my version and that it has been fixed in the last release?
Otherwise I cannot figure out why I have this issue in my code.

Thanks
Fabio 
0
Accepted
Dimiter Madjarov
Telerik team
answered on 22 Feb 2013, 03:30 PM
Hello Fabio,


Yes, this was an issue in version 2012.3.1114, but was fixed in 2012.3 1315. This is also described in the release notes:
"Fixed: The widget does not preserve the ID of the LI element"

You could find the rest of the changes and bug fixes here.
Wish you a great day.

 

Kind regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TreeView
Asked by
Gaetano
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Gaetano
Top achievements
Rank 1
Share this question
or