PDA

View Full Version : Trying out my first aux - Form Field Mask



ethraza
21 May 2014, 4:56 AM
Because Architect crash hard the canvas by ignoring Resources, I'm trying to convert my Field Masking plugin into a Architect User Extension.
(Canvas issue and plugin usage here: http://www.sencha.com/forum/showthread.php?285663-Design-View-crashing-because-of-a-plugin)


The problem right now is that the blog post "Building a User Extension part 2" and the Docs, just say about aux carring view components, it say nothing about ExtJs plugins.

So, it is a plugin. It needs to be called within a form field in the plugin config option.
How do I do that?

The aux I have till now is attached here (renamed to zip so it can be attached).
But it shows itself inside Architect as a component to be added to a view and not a plugin to be added to a component. It's probably just some stuff in the package.json or Definition.js, but I don't know what.



I hope this aux will be very useful for other people when the package is working right, cuz there is nothing similar in the sencha marketplace.
Thank you for any help.

Juvs
21 May 2014, 4:24 PM
I have a similar plugin, is designed for fields, not for Panels, the docs from Architect says (see this link (http://docs.sencha.com/architect/3/reference/files_directories.html)) for definition file:

validParentTypes:

Array of valid parent types (use strings corresponding to xtype) for this object; if any types are listed here, this component will only be allowed to be dropped onto components matching one of the types in this list

validChildTypes:

Array of valid child types for this object; if any components are listed here, they are the only types of components that can be children to this component

So I set validParentTypes to "textfield", but still can't attach to this kind of component. :((:((

Maybe is some limitation with Architect, folks from Sencha: any advice?

honestbleeps
22 May 2014, 9:49 AM
sorry it took some time to respond here, ethraza -- it appears what you need to do is update your component to extend Ext.AbstractPlugin and then it works in Architect and doesn't crash anything. If you need the functionality of Ext.util.Observable - you can always include that as a mixin.

honestbleeps
22 May 2014, 9:51 AM
I have a similar plugin, is designed for fields, not for Panels, the docs from Architect says (see this link (http://docs.sencha.com/architect/3/reference/files_directories.html)) for definition file:

validParentTypes:

Array of valid parent types (use strings corresponding to xtype) for this object; if any types are listed here, this component will only be allowed to be dropped onto components matching one of the types in this list

validChildTypes:

Array of valid child types for this object; if any components are listed here, they are the only types of components that can be children to this component

So I set validParentTypes to "textfield", but still can't attach to this kind of component. :((:((

Maybe is some limitation with Architect, folks from Sencha: any advice?

Hmm, how are you listing your validParentTypes, exactly? Can you share your definition with us?

Juvs
22 May 2014, 1:43 PM
For now we are just setting textfield using xtype, here the sample:


{
"classAlias": "plugin.clearbutton",
"className": "Ext.ux.form.field.ClearButton",
"inherits": "abstractplugin",
"autoName": "MyClearButtonPlugin",
"helpText": "<b>Ext.ux.form.field.ClearButton</b><br>Plugin for text components that shows a clear button over the text field. When the button is clicked the text field is set empty. Works with Ext.form.field.Text, Ext.form.field.TextArea, Ext.form.field.ComboBox and Ext.form.field.Date.",
"validParentTypes": ["textfield"],

"toolbox": {
"name": "Clear Button Plugin",
"category": "Form Fields",
"groups": ["Forms"]
},
...

Also we try extend the plugin using Ext.AbstractPlugin but still same issue. See the attach file, when we try to drag & drop into Text Field, we just can't.

49092

This plugin is base on extension Ext.ux.form.field.ClearButton by Fortis IT Services GmbH

Here's the complete zip file for the plugin, just unzip this on your extensions directory (configure on Architect) to test.

ethraza
23 May 2014, 4:01 AM
Ext.AbstractPlugin didn't work to my aux as well.