PDA

View Full Version : [CLOSED] TreePanel Expandable



osef
Dec 12, 2012, 8:18 PM
Hi Team Ext.Net Could you please help me with this thread?

http://forums.ext.net/showthread.php?21463-TreePanel-Expandable-false-does-not-prevent-collapse

Thank you

Baidaly
Dec 13, 2012, 12:54 AM
Hello, @osef!

Sorry, but it's not good to post just link to another question. For example, it can be difficult to find what did you want if the linked question will be deleted. Rules about posting new questions you can read on this thread: http://forums.ext.net/showthread.php?3440

According to your problem, look at the following sample. The main idea is to override CSS rules to hide expande/collapse tool and to prevent collapsing by listening BeforeItemCollapse event:



<style>
.x-tree-arrows .x-tree-elbow-plus, .x-tree-arrows .x-tree-elbow-minus, .x-tree-arrows .x-tree-elbow-end-plus, .x-tree-arrows .x-tree-elbow-end-minus,
.x-tree-lines .x-grid-tree-node-expanded .x-tree-elbow-end-plus, .x-tree-lines .x-tree-elbow-end-plus {
background: none;
}

</style>
@{
var treeView = new Ext.Net.TreePanel();

treeView.Region = Region.Center;
treeView.Title = "sample";
treeView.Listeners.BeforeItemCollapse.Handler = "return false";
var root = new Ext.Net.Node()
{
Text = "Menu",
NodeID = "node0",
Expanded = true,
Expandable = false
};

var subItem1 = new Ext.Net.Node()
{
Text = "SubItem 1",
NodeID = "node1",
Expanded = true,
Expandable = false
};


var subItem2 = new Ext.Net.Node()
{
Text = "SubItem 2",
NodeID = "node2",
Leaf = true
};

subItem1.Children.Add(subItem2);
root.Children.Add(subItem1);

treeView.Root.Add(root);
}

@(Html.X().Viewport()
.Layout(LayoutType.Border)
.Items(i => i
.Add(treeView)
)
)

Daniil
Dec 13, 2012, 4:48 AM
Hi everybody,

I think there is a bug in the ExtJS docs.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.NodeInterface-cfg-expandable

I see in the sources that it is true by default, not false.

It is the reason why Expandable="false" is not rendered to a client and, therefore, doesn't work.

I corrected it in SVN. Now the Expandable="false" works as expected.

osef
Dec 13, 2012, 6:16 AM
Hi Baidaly, I'm sorry for this action, I don't return to do again and your code It's working thank you for your support.

Baidaly
Dec 13, 2012, 6:28 AM
No problem ;)