Skip to content

Instantly share code, notes, and snippets.

@silentworks
Last active December 14, 2015 12:49
Show Gist options
  • Save silentworks/5089169 to your computer and use it in GitHub Desktop.
Save silentworks/5089169 to your computer and use it in GitHub Desktop.
Creating buttons in ExtJS to use in MODX
Careers.button.btnRenderer = function (v, config) {
var config = config || { bodyStyle: '', holderStyle: 'float:left', style: {} };
var id = Ext.id();
(function() {
var btn = new Ext.Button({
renderTo: id
,text: config.text
,bodyStyle: config.bodyStyle
,style: config.style
,handler: config.handler
});
}).defer(15);
return (String.format('<div id="{0}" style="{1}"></div>', id, config.holderStyle));
}
/* How to use */
{
header: _('lexicon_name'),
width: 120,
renderer: function(v, p, record) {
return Careers.button.btnRenderer(v, {
text: _('lexicon_name')
,holderStyle: 'float:left; margin: 0 3px;'
,style: {
padding: '0 10px'
}
,handler: function (btn, e) {
showPosWindow(pid);
}
}) +
Careers.button.btnRenderer(v, {
text: _('lexicon_name')
,holderStyle: 'float:left; margin: 0 3px 0 10px;'
,style: {
padding: '0 10px'
}
,handler: function (btn, e) {
deletePosition(pid);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment