PDA

View Full Version : using user xtypes with extdesigner



abdelaat
25 Oct 2010, 2:36 AM
Hello,
could you tell me how i can use my own xtype components within extdesigner or a way to integrate them after project export without having to rewrite anything every time i regenerate the files by extdesigner
Thank you.

jarrednicholls
25 Oct 2010, 5:11 AM
Hi abdelaat,

The easiest technique is to put a "placeholder" component, where you want your ux (custom component) to be configured/rendered. Give it an ID or setup its ref (autoRef) accordingly so you can access it easily. Then, there is this nice function posted on the forums here that will replace the placeholder component with the component you want: http://www.sencha.com/forum/showthread.php?103560-How-to-replace-placeholder-components

Generally speaking, you should be able to simply use a BoxComponent as a place holder, just about anywhere. If not (i.e. it's not allowed as a child), you can use the appropriate child component, e.g. a TextField, and have it replaced.

The replacement should happen in the initComponent function of the appropriate exported .js file. If you replace the component in initComponent, that is all that is needed. If you replace it after all of the components have rendered and laid themselves out, you will have to call "doLayout()" on the parent component to force a layout with your new custom component.

Hope that helps. Let me know that you get it working okay.

abdelaat
25 Oct 2010, 7:12 AM
Thank you very much i'll try that hook and let you know that it's working.

abdelaat
26 Oct 2010, 2:56 AM
Hi jarrednicholls,
I finally got it working by calling the replacement at the onAfterRender event of the placeholder's container.
Thanks very much

jarrednicholls
26 Oct 2010, 5:08 PM
Most excellent, good work. Glad you got it working.

dotnetwise
1 Nov 2010, 1:16 AM
what about two things?
1. Let me 'edit' the xtype of the "Container" element
2. Add a property on all the components where I can define other attributes i.e. plugins etc. that are not supported by the designer, but I want to have them in the generated ui code.

Thanks!