-
26 Nov 2012 6:57 AM #1
Answered: Tree node hyperlink
Answered: Tree node hyperlink
Hi,
I have a tree,
I used this example,Code:var tree = Ext.create('Ext.tree.Panel', { store: store, frame: true, renderTo: 'tree_el', height: 400, width: 400 });
http://dev.sencha.com/deploy/ext-4.0...e/reorder.html
I want to give same hyperlink to all nodes of this tree, how that can be done?
And how can we align a panel center? The above panel for example.
Thanks in advance!
-
Best Answer Posted by Arg0n
In your get-nodes.php you should have something like an array with your nodes:
To center your TreePanel you need to edit the layout of your component around your TreePanel:Code:array( 'text' => 'this is a hyperlink', 'href' => 'http://google.com' );
Code:layout: { align: 'center' }
-
26 Nov 2012 7:08 AM #2Sencha - Community Support Team
- Join Date
- Nov 2007
- Location
- Helsingborg, Sweden
- Posts
- 2,454
- Vote Rating
- 48
- Answers
- 29
You can use the 'href' property of the NodeInterface, when sending your node data.
http://docs.sencha.com/ext-js/4-1/#!....NodeInterface
-
26 Nov 2012 7:09 AM #3
When you create your store, use the 'href' property.
TreeData Example:
And what do you mean by the panel? :xCode:{ id: 'bla', text: 'this is a hyperlink', href: 'http://google.de' }
-
27 Nov 2012 12:09 AM #4
Hi,
Thanks for the reply, if you see the example,
Store is created there, where do you mean I have give href?Code:Ext.require([ 'Ext.tree.*', 'Ext.data.*', 'Ext.tip.*' ]); Ext.onReady(function() { Ext.QuickTips.init(); var store = Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', url: 'get-nodes.php' }, root: { text: 'Ext JS', id: 'src', expanded: true }, folderSort: true, sorters: [{ property: 'text', direction: 'ASC' }] }); var tree = Ext.create('Ext.tree.Panel', { store: store, viewConfig: { plugins: { ptype: 'treeviewdragdrop' } }, renderTo: 'tree-div', height: 300, width: 250, title: 'Files', useArrows: true, dockedItems: [{ xtype: 'toolbar', items: [{ text: 'Expand All', handler: function(){ tree.expandAll(); } }, { text: 'Collapse All', handler: function(){ tree.collapseAll(); } }] }] }); });
I don't understand NodeInterface, is there an example?
Panel alignment is aligning the above tree panel in the center, now I am giving,
which don't seem to be a good idea, because there can be changes in monitor sizes, so center should do it.Code:margin: '100 0 0 500'
-
27 Nov 2012 12:27 AM #5
In your get-nodes.php you should have something like an array with your nodes:
To center your TreePanel you need to edit the layout of your component around your TreePanel:Code:array( 'text' => 'this is a hyperlink', 'href' => 'http://google.com' );
Code:layout: { align: 'center' }
-
27 Nov 2012 3:10 AM #6
I missed to tell, I want to have click (link) only in the leaf, that will have same url for all.
-
27 Nov 2012 6:49 AM #7
-
27 Nov 2012 7:01 AM #8
Damn... I knew it xD
It also doesn't work in the TreePanel itself? If you write the layout config into the TreePanel :x
Another solution might be layout: 'ux.center', but documentation says that it's ExtJs 4.1.2 only...
-
27 Nov 2012 7:37 AM #9
It isn't working, I was trying to align complete panel in the center for sometime now, but in vainCode:layout: 'ux.center'
.
-
28 Nov 2012 12:09 AM #10
To be honest, I never tried to center something before. But it can't be so complicated...
If you look into the ExtJs Layout Browser Example, you will see under the node "Custom layouts" something with center. They use ux.center fot it. Which is the class Ext.ux.layout.Center. You could check, if you have this class, else download it and include it into your src. >.<


Reply With Quote
, href worked good, but align isn't working
.