PDA

View Full Version : Modifying Fields within a Form



stoertebeker
6 Jun 2012, 12:59 PM
Hi,
I am trying to modify the appearance of a field (as part of a form), i.e. instead of showing the value I would like to replace it by an image. I thought that this could be done by using a template. I tried to configure the 'renderTpl' which led to a runtime error and prohibited the whole page from showing. I tried to configure the 'tpl' which changes nothing. Any hint is appreciated.
Thanks
ok

scottmartin
6 Jun 2012, 4:30 PM
A large image, or an image that could be contained in an combobox of images?

Scott.

stoertebeker
7 Jun 2012, 12:47 AM
No, more like an icon. So, for example instead of having a text with a checkbox (type: boolean) I would like to show an icon for the 'true' value and nothing for the 'false' value.

Or as another example I would like to combine 2 or more values from a store into one form field (e.g. by concatenation).

ok

scottmartin
7 Jun 2012, 6:12 AM
In reading your description, would an icon combo work? Text with image
http://www.sencha.com/forum/showthread.php?131184-IconCombo

You can simply hide the trigger to it looks like a textfield instead of a combo.

Scott.

stoertebeker
7 Jun 2012, 6:55 AM
Will try.

But still curious why usage of 'renderTpl' on the field (e.g. displayfield) does not work?

Did some test:
1.when I have the field directly underneath a Viewport a 'renderTpl' overwrites the standard values (label and default value), even using renderData works; althoug the browser show a runtime error:(Uncaught TypeError: Cannot read property 'dom' of null
2. when i have the same config and include such a field into a form, the encompassing form is corrupted (no header), but the template show as expected; same error message as above
3. when I have such a field and a form (with another displayfield) on the same level, the form disappears when i set the renderTpl on the field that show before the form; when i move it behind the form, the form is shown but corrupted;

I would just like to understand if i have a general misunderstanding or what else I would have to do?

ok
3.