{
xtype: MODx.config.publish_document ? 'modx-combo-user' : 'hidden'
,fieldLabel: _('resource_createdby')
,description: '<b>[[*createdby]]</b><br />'+_('resource_createdby_help')
,name: 'created_by'
,hiddenName: 'createdby'
,id: 'modx-resource-createdby'
,anchor: '100%'
,value: config.record.createdby || MODx.user.id
}
MODx.combo.User = function(config) {
config = config || {};
Ext.applyIf(config,{
name: 'user'
,hiddenName: 'user'
,displayField: 'username'
,valueField: 'id'
,fields: ['username','id']
,pageSize: 20
,url: MODx.config.connector_url
,baseParams: {
action: 'security/user/getlist'
}
,typeAhead: true
,editable: true
});
MODx.combo.User.superclass.constructor.call(this,config);
};
Ext.extend(MODx.combo.User,MODx.combo.ComboBox);
Ext.reg('modx-combo-user',MODx.combo.User);
/* store the original onLoad method to have acces to it in the override */
var originalComboBoxOnLoad = Ext.form.ComboBox.prototype.onLoad;
/* fixes combobox value loading issue */
Ext.override(Ext.form.ComboBox, {
loaded: false
,setValue: Ext.form.ComboBox.prototype.setValue.createSequence(function(v) {
var a = this.store.find(this.valueField, v);
if (v && v !== 0 && this.mode == 'remote' && a == -1 && !this.loaded) {
var p = {};
p[this.valueField] = v;
this.loaded = true;
this.store.load({
scope: this
,params: p
,callback: function() {
this.setValue(v);
this.collapse()
}
})
}
})
// this sets the width of combobox dropdown lists automatically to the width of the combobox element
// and thus prevents the sometimes unnecessary wide dropdowns
,onLoad: function() {
var ret = originalComboBoxOnLoad.apply(this,arguments);
// true flag on getWidth() to ignore border and padding
var maxwidth = Math.max(this.minListWidth || 0, this.wrap.getWidth(true));
this.list.setWidth(maxwidth);
return ret;
}
});
I only know what the second part (e.g. onLoad) does as it comes from me, the setValue stuff I don't know what exactly it does, guess your issue is more located in this direction right?
$id = $this->getProperty('id');
if (!empty($id)) {
$c->where(array(
'id' => $id
));
}Try to add this code to the prepareQueryBeforeCount method in https://github.com/modxcms/revolution/blob/2.x/core/model/modx/processors/security/user/getlist.class.php#L35
$id = $this->getProperty('id'); if (!empty($id)) { $c->where(array( 'id' => $id )); }