-
13 Aug 2011 3:05 PM #1
Answered: how can i put picture for information between text and textfield
Answered: how can i put picture for information between text and textfield
Hi,
Is any one knows ,How can I put any picture between text and textfiled.
like this question mark picture icon ,for getting information about text field
questions.jpg
-
Best Answer Posted by mitchellsimoens
That's just overnesting...
Just need to insert the image tag into the label. You may want to check out Ext.form.Labelable and the labelableRenderTpl property
-
13 Aug 2011 3:44 PM #2
Here are a couple of ways to do it, I'm sure there are more.
Code:new Ext.form.field.Text({ fieldLabel: 'Hello<img src="pic.png" />', labelSeparator: '' }),It's then just a case of tidying up the widths, paddings, margins, etc. to get it all looking the way you want.Code:var textField = new Ext.form.field.Text(); new Ext.container.Container({ items: [ { forId: textField.getInputId(), text: 'Hello', xtype: 'label' }, { src: 'pic.png', xtype: 'image' }, textField ], layout: { align: 'middle', type: 'hbox' } });
The first option may appear simpler but personally I think I prefer the second option.
-
13 Aug 2011 4:22 PM #3
I like that second option, too. The image component lets you easily set event handlers, set the src, etc. You might wrap them in a fieldcontainer instead of just a container since fieldcontainer is labelable.
http://docs.sencha.com/ext-js/4-0/#/api/Ext.form.FieldContainer
-
13 Aug 2011 6:19 PM #4Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,084
- Vote Rating
- 453
- Answers
- 3153
That's just overnesting...
Just need to insert the image tag into the label. You may want to check out Ext.form.Labelable and the labelableRenderTpl propertyMitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
14 Aug 2011 3:03 PM #5


Reply With Quote