Skip to content

Instantly share code, notes, and snippets.

@c3ry5
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save c3ry5/db6bcef55e1774a760ee to your computer and use it in GitHub Desktop.
Save c3ry5/db6bcef55e1774a760ee to your computer and use it in GitHub Desktop.
An exjs trigger callback xtype for AEM/CQ
var triggerCallback = CQ.Ext.extend(CQ.Ext.form.TriggerField, {
initComponent: function() {
triggerCallback.superclass.initComponent.call(this)
},
triggerClass: "x-form-search-trigger",
onTriggerClick: function() {
if(this.callback) {
this.callback.call(this);
}
},
refresh: CQ.Ext.emptyFn,
listeners: {
"change": function(object, newValue, oldValue) {
if (this.validate()) {
this.disable();
this.onTriggerChange.call(this, newValue, oldValue);
this.enable()
}
}
}
});
CQ.Ext.reg("triggercallback", triggerCallback);
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Dialog"
height="600"
title="Header"
width="650"
xtype="dialog">
<items jcr:primaryType="cq:WidgetCollection">
<tabPanel
jcr:primaryType="cq:TabPanel"
xtype="tabpanel">
<items jcr:primaryType="cq:WidgetCollection">
<nitroconfiguration
jcr:primaryType="cq:Widget"
anchor="100%"
title="Nitro"
xtype="panel">
<items jcr:primaryType="cq:WidgetCollection">
<nitroResource
jcr:primaryType="cq:Widget"
allowBlank="true"
fieldLabel="Trigger Callback"
name="./triggercallback"
callback="function() {console.log(this);}"
xtype="triggercallback"/>
</items>
</nitroconfiguration>
</items>
</tabPanel>
</items>
</jcr:root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment