Sencha Architect: extend Ext.form.field.Picker - extjs

In Sencha Architect I want to extend the Ext.form.field.Picker to create a custom component. But the Ext.form.field.Picker is not in the available toolbox elements. Can I do it somehow?
I try to override the trigger field, and change the:
extend: 'Ext.form.field.Trigger'
to
extend: 'Ext.form.field.Picker'
but it does nothing.

In your Sencha Architect (preferably version 3.1) click on the plus sign (top right corner) inside the Project Inspector, select Class and View.
You will get a new empty class being extended from Ext.Base. Change the extend property to Ext.form.field.Picker and you should get a popup asking "Would you like to transform this Class to a Ext.form.field.Picker, to enable full configuration and behavior". Click yes and you should be good to go.

Related

How do I override a shared wagtail admin template?

In wagtail currently a standard select is used for a one to many relation, and I'd like to override this to use a jquery UI autocomplete widget.
I found the template that renders the component in wagtail/admin/templates/wagtailadmin/shared/collection_chooser.html, so I Thought that by following the instructions I could override the template the way I would a base one, but unfortunately when I create myapp/templates/wagtailadmin/shared/collection_chooser.html it is not rendered in place of the base one. I did confirm that by creating myapp/templates/wagtailadmin/base.html that does get used.
How can I override this template short of editing the source?

How to hide a CQ component dynamically using Extjs?

I need to hide a CQ component from the page, when I select a particular value from another components dialog. Is this possible using ExtJS?
Yes, it is possible, but without more info it is difficult to give more details. In general, you can look up the xtypes you are using in your dialog at http://dev.day.com/docs/en/cq/current/widgets-api/index.html. Find the events that are available for the xtypes you are using in the dialog, then add a listener for one of the events exposed by that xtype. That allows you to run your own JavaScript code in response to an event--and that code could do things like hide HTML DOM elements.
Here is an example of using a listener to add custom functionality in response to an event: http://cq.shishank.info/2011/12/20/adding-limit-to-multifiled/
And here is another example: CQ5 - Hiding a tab within a component dialog depending on user group?

How to access toolbar object of nestedlist view from another view's callback in sencha touch?

I am new in Sencha Touch, so I don't know it's full structure. So the question is a little stupid, i guess :)
I have a view it is a nestedlist object. I have created a toolar object inside my nestedlist. Now I want to manipulate this toolbar from another view's callback. How can I access my toolbar object located in nestedlist view from event callback from another view object?
With that little information on your structure (are you using the MVC pattern? No example code given) I can only say that you can definitely achieve this with Ext.ComponentQuery
Lets say you added a custom property to your toolbar named ident='myToolbar' then you can access this toolbar (precisely said any toolbar with that custom property) by calling
Ext.ComponentQuery.query('[ident=myToolbar]')[0]
The result will be always a array but in this example we accept only one result, that is why I added [0]
For further information refer to the API. Ext.ComponentQuery is mighty if you know how to use it.
First give your toolbar an id, for example myToolbar. Then, in your callback, you can do something like this
var toolbar = Ext.getCmp('myToolbar');
to get your toolbar object. Next you can manipulate the toolbar using the toolbar variable, for example change the title:
toolbar.setTitle('New Title');
More info about getCmp() here.
More info about the toolbar here (Check the toolbar's methods to manipulate it).

Vaadin ComboBox invisible when readonly

Why does a Vaadin ComboBox get invisible when doing setReadOnly(true)?
Screenshots
normal
invisible
The source code
import java.util.List;
import com.vaadin.ui.ComboBox;
public class PropertyComboBox extends ComboBox
{
public PropertyComboBox(List<String> properties)
{
super();
for(String property: properties) {this.addItem(property);}
this.setImmediate(true);
this.setMultiSelect(false);
this.setNewItemsAllowed(false);
this.setInputPrompt("Property");
this.setReadOnly(true);
}
}
If you are trying to create a combo box in which the user can't write anything, check out the NativeSelect component.
From the API doc:
This is a simple drop-down select without, for instance, support for multiselect, new items, lazyloading, and other advanced features. Sometimes "native" select without all the bells-and-whistles of the ComboBox is a better choice.
If you don't need these features, then you should definetely consider using NativeSelect.
All components get "invisible" when you set them to read only. I couldn't find any reason for that and was wondering too.
My suggestion (a bit hacky): disable the components and change their disabled appearence within CSS.
Nexus is right, component become invisible when set to readOnly. In fact setting to read-only add the "v-readonly" css classname and the CSS do the rest.
Regards.

Referencing current dialog in ExtJS from a CQ5 component dialog

I'm new to CQ5 and ExtJS and this is my scenario:
I created a new component with its own dialog for authoring. In the dialog I added a checkbox field with a custom xtype that I created. What I want to do is this:
Whenever the checkbox is checked/unchecked, I want to dynamically add/remove a TAB to the existing dialog to show further authoring options.
I've seen how to handle ExtJS' Window and TabPanel but I can't figure out how to get the reference of the dialog I'm in so that I can manipulate it (add/remove tabs).
I tried CQ.Ext.WindowMgr.getActive() to see if that gets me my window/dialog but it's not giving me what I expect.
Any ideas? Thanks!
You probably want to add listener(s) to your field.
http://dev.day.com/docs/en/cq/current/developing/widgets.html#Dynamic Dialogs
You should be able to use this.findParentByType to find the parent dialog.

Resources