PDA

View Full Version : [CLOSED] NestedList - setting the node's visible-property doesn't affect the visibility.



sveins12
Aug 14, 2016, 2:29 PM
I am trying to hide some nodes from a NestedList, and I want to show it later. But I cannot figure out how. Also, I would like to hide the node during the configuration (C#-code), but I cannot find any Visible or Hidden property for the nodes.



@{
var x = Html.X();
}
@(
x.NestedList()
.Store(c=> c.Add(x.TreeStore()
.Root(x.Node()
.Children(
x.Node()
.Text("Node0")
,
x.Node()
.Text("Node1")
)
)
))
.Listeners(l=>l.Initialize.Handler= @"
// Putting Node0 into a record-variable:
var record = item.getStore().getRoot().childNodes[0];

// Logging the visible-property on the console shows that visible=true;
console.log('Node0 visible:', record.get('visible'));

// Setting visible to false:
record.set('visible', false);

// Logging shows that the the visible-property is now false:
console.log('Node0 visible:', record.get('visible'));

// Right now the first node in the list should be hidden, but it is still visible.
// Is there some refresh-method that should be called here?
")
)

fabricio.murta
Aug 15, 2016, 10:23 PM
Hello!

It does not seem the NestedList supports hiding specific entries at all, although the property is inherited by the Ext.data.Model object.

But here's something that "works" and may be worked upon the best way to hide the node:



<script type="text/javascript">
Ext.defer(function () { App.NestedList1.getAt(0).getAt(0).innerItems[0].hide(); }, 2000);
</script>


I might spend a little more time on this because it seems unavailable on the events I tried so far on the nested list, and also if I just run it on Ext.onReady(). But might be useful to hide on-the-run. Notice I added a .ID("NestedList1") to the component in order to be able to do this.