Answer the question
In order to leave comments, you need to log in
Yii remember tree state?
There is such a task - to remember the state of the tree. I think to write in session. from here we have - you need js to find out the style of the object console.log(document.getElementById('13').classList.contains('open'));
and somehow pass it to the controller, and then save it to the array. very vague idea how to do it
on click
document.getElementById("tree").onclick = new Function("console.log(this)");
<ul id="tree" class="filetree treeview">
<ul>
<li id="13" class="closed expandable">
<li id="45" class="closed expandable">
<li id="6" class="closed expandable">
<div class="hitarea closed-hitarea expandable-hitarea"></div>
<a class="" href="/proizvodstvo/site/page?view=frameset&frame=6">ЛАЦ</a>
<ul style="display: none;">
</li>
<li id="2" class="closed expandable lastExpandable">
<div class="hitarea closed-hitarea collapsable-hitarea lastCollapsable-hitarea"></div>
<a class="" href="/proizvodstvo/site/page?view=frameset&frame=2">страница</a>
<ul style="display: block;">
Answer the question
In order to leave comments, you need to log in
Try using jquery cookies
$('#tree').click(function(){
if($(this).hasClass('treeview')){
$.cookie('treeview', 'true');
} else {
$.cookie('treeview', 'false');
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question