PDA

View Full Version : Checkbox menu item with embedded combobox



Moinois
21 Jan 2011, 4:07 PM
Hi all,

I've tried to put a combo box inside a checkbox menu item without success. What I would like to achieve is something like this:

[x] Not named: [combo box with list 1 to 10]

What I've come up with so far is something that have the elements the way I would like to but it doesn't really look right. I.e. the checkbox isn't aligned with the others, the menu item doesn't "light up" when you hoover over it and the text is also misaligned and doesn't have the right class to look like the other menu texts. :((

I've used a compositefield, maybe that's not the right way to do this? I was thinking of extending the checkmenuitem but I'm not that experienced to get how to do it... And I was also considering if I could make this by using a template somehow, but.. how?

Currently when I select a value in the combo the menu disappears so you have to click on the menu button again to see what you selected and it diminishes the user experience, is there any way to prevent that from happening?

My code so far:


...
,tbar:[
{
xtype: 'tbbutton'
,text: 'Persons'
,menu: [
{ text: 'John Doe', checked: false, hideOnClick: false }
,{ text: 'Friends'
,hideOnClick: false
,menu: [
{ text: 'Jane Doe', checked: false, hideOnClick: false }
]
}
,{
xtype: 'compositefield'
,items: [
{
xtype : 'checkbox'
,width : 20
}
,{
xtype : 'label'
,text : 'Not named:'
},
{
xtype : 'combo'
,editable : false
,triggerAction : 'all'
,lazyRender : true
,mode : 'local'
,valueField : 'myId'
,displayField : 'displayText'
,flex: 1
,store: new Ext.data.ArrayStore({
id : 0
,fields: [
'myId'
,'displayText'
]
,data: [
[1, 1]
,[2, 2]
,[3, 3]
,[4, 4]
,[5, 5]
,[6, 6]
,[7, 7]
,[8, 8]
,[9, 9]
,[10, 10]
]
})
}
]
}
]
}
]
...


I know that I have many questions but it's because I'm not sure that I'm on the right track here... I'm not looking for a complete solution here, just a nudge in the right direction.

Thanks!

valititi
21 Jan 2011, 8:41 PM
Hi Moinois !
1. I am a rookie, just like you (only 2-3 months in Ext)... But, I see some habits (normals also) here...
2. So, beginning with "Hi all Ext gurus!" may seems a little too... strong ?! :-)
3. Then is not to nice to put in your question verbs as "I want"... Is too imperatif ! :-) I think (maybe I am wrong !) that something like "I wish" or "I need to" can be a little bit better...
4. "I'm stuck, any help is appreciated!" Yes, why not ? Every guru will be very happy to know "any help is apreciated", because all of them wait (in a normal mode) to be punish for help :-) Now... Is too strong man !!!
5. Finally knowing that you give a bonus for the final menu... when selecting, will finally excite for sure the gurus more than everything else...
:-)

Moinois
22 Jan 2011, 3:14 AM
Hi valititi,

Thank you for your post, you're of course right. Since English isn't my native tongue some aspects of the language is missing. And I should have remembered that in all communication it's the receiving end that has the right to interpret. It was 1 AM as I wrote it and I was in a silly, humorous mood and I guess I added a little too much spice to the post.

I will tone down my post and hope that someone else can help me with my actual problem.

Thanks!