Last active
August 29, 2015 14:08
-
-
Save vgrish/ab6354678b52eb98c7e3 to your computer and use it in GitHub Desktop.
свой комбо в настройки
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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