PDA

View Full Version : Get the selected menu



fabbydesign
14 May 2012, 2:25 AM
I have the Layout Browser example from sencha docs, and when i press on the tree menu, its open a form, that has the items:



{ x: 10, y: 33, xtype: 'label',
text: 'Description:' },Ext.create('Ext.form.HtmlEditor', { x:5, y:55, hideLabel: true, name:'description', allowBlank:false, height: 450, anchor: '100%', plugins: [new Ext.create('Ext.ux.form.HtmlEditor.imageUpload', {managerUrl:'/admin/htmleditor/'+getSelectedMenu()})] }

where getSelectedMenu() take the qtitle of the tree menu like this:



function getSelectedMenu(){ var nodes=Ext.getCmp('tree-panel').getSelectionModel().getLastSelected(); if(nodes){ var menuSelected=Ext.getCmp('tree-panel').getSelectionModel().getLastSelected().data.qtitle; } console.log(menuSelected); return menuSelected;}

The problem is that when i access the function getSelectedMenu when the HtmlEditor is shown, appear at managerUrl something like this:
/admin/htmleditor/undefined.

If i acces getSelectedMenu when i click a menu, then is ok, but on htmleditor appear undefined.
This plugin, is to upload pictures, and i want to send the url where to upload data.

Thanks.

scottmartin
14 May 2012, 12:51 PM
You do not have a qualifier for getSelectedMenu()

Regards,
Scott.