Skip to content

Instantly share code, notes, and snippets.

@vgrish
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgrish/ab6354678b52eb98c7e3 to your computer and use it in GitHub Desktop.
Save vgrish/ab6354678b52eb98c7e3 to your computer and use it in GitHub Desktop.
свой комбо в настройки
<script type="text/javascript">
// This a demo combo, instead use your own with your processor to load your "options"
var msfavoritesXtype = function(config) {
Ext.apply(config, {
store: new Ext.data.SimpleStore({
fields: ["data","value"]
,data: [
[_('msfavorites_opt_0'), "0"]
,[_('msfavorites_opt_1'), "1"]
,[_('msfavorites_opt_2'), "2"]
]
})
,displayField: "data"
,valueField: "value"
,mode: "local"
});
msfavoritesXtype.superclass.constructor.call(this, config);
};
Ext.extend(msfavoritesXtype, MODx.combo.ComboBox);
Ext.reg("msfavorites-combo-opt", msfavoritesXtype);
Ext.onReady(function() {
Ext.override(MODx.combo.xType, {
listeners: {
afterRender: {
fn: function(elem) {
var store = elem.getStore();
// Add your custom xtype(s)
var newXtypes = [
new Ext.data.Record({
d: "msfavorites opt"
,v: "msfavorites-combo-opt"
})
];
store.add(newXtypes);
}
,scope: this
}
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment