Version Modx 2.2.8
Extending an existing CMP Add-on (so migxdb is not an option)
I have a superboxselect component that gets its store remotely via a getlist processor. Unfortunately, it looks like the typeAhead autocomplete feature is missing some sort of configuration in that when I start typing, it ALWAYS returns the first item in the store. Doesn't matter what is typed.
To use typeAhead with a remote store, does a listener need to be used (to call a processor that searches the store), or what?
Code:
Component ExtJS -
MODx.combo.Users = function (config) {
config = config || {};
Ext.applyIf(config, {
xtype:'superboxselect'
,triggerAction: 'all'
,mode: 'remote'
,forceSelection: true
,lazyRender: true
,editable : true
,valueField: 'internalKey'
,displayField: 'fullname'
,typeAhead:true
,minChars:1
,store: new Ext.data.JsonStore({
idProperty:'id',
autoLoad: true,
remoteSort: true,
root:'results',
fields: ['fullname', 'internalKey'],
url: mxcCore.config.connectorUrl,
baseParams:{
action: 'mgr/contacts/getList'
}
})
});
MODx.combo.Users.superclass.constructor.call(this, config);
};
Ext.extend(MODx.combo.Users, Ext.ux.form.SuperBoxSelect);
Ext.reg('modx-superbox-user', MODx.combo.Users );
getList Processor
$eventId = $modx->getOption('eventid',$scriptProperties,0);
/* build query */
//-- get all active users
$c = $modx->newQuery('modUser');
$c->where(array('active'=>1));
$mxUsers = $modx->getCollectionGraph('modUser',array('Profile'=>array()), $c);
/* iterate */
$list = array();
foreach ($mxUsers as $mxu) {
$mxcArray = $mxu->Profile->toArray();
if(empty($mxcArray['fullname']))continue;
if($mxcArray['internalKey']===1)continue;
$list[]= $mxcArray;
}
return $this->outputArray($list,$count);
This is code that I am extending/customizing originally created by Charless for his mxCalendar add-on