Autocomplete 在socialengine上自动完成好友列表
如何在一个包含两个不同文本框的页面中使用socialengine上的撰写消息中使用的自动完成器Autocomplete 在socialengine上自动完成好友列表,autocomplete,socialengine,Autocomplete,Socialengine,如何在一个包含两个不同文本框的页面中使用socialengine上的撰写消息中使用的自动完成器 我知道我们可以用一个id为“to”的文本框来完成自动完成的工作。但是如何在另一个id为eventto的文本框上使用相同的自动完成功能 只需根据请求更改id(此处为toe) new Autocompleter.Request.JSON('toe','{ “minLength”:1, “延迟”:250, “选择模式”:“选择”, “自动完成类型”:“消息”, “多重”:错误, 'className':'m
我知道我们可以用一个id为“to”的文本框来完成自动完成的工作。但是如何在另一个id为eventto的文本框上使用相同的自动完成功能 只需根据请求更改id(此处为toe)
new Autocompleter.Request.JSON('toe','{
“minLength”:1,
“延迟”:250,
“选择模式”:“选择”,
“自动完成类型”:“消息”,
“多重”:错误,
'className':'message autosuggest',
“filterSubset”:true,
“令牌格式”:“对象”,
'tokenValueKey':'label',
“injectChoice”:函数(令牌){
if(token.type=='user'){
变量选择=新元素('li'{
“类”:“自动完成器选项”,
“html”:token.photo,
'id':token.label
});
新元素('div'{
“html”:此.markQueryValue(token.label),
“类”:“自动完成器选择”
}).注入(选择);
this.addChoiceEvents(choice).inject(this.choices);
选择存储('autocompleteChoice',令牌);
}
否则{
变量选择=新元素('li'{
'class':'autocompleter-choices-friendlist',
'id':token.label
});
新元素('div'{
“html”:此.markQueryValue(token.label),
“类”:“自动完成器选择”
}).注入(选择);
this.addChoiceEvents(choice).inject(this.choices);
选择存储('autocompleteChoice',令牌);
}
}
,onPush:function(){
}
});
如何获取所有用户列表而不是仅获取好友?
new Autocompleter.Request.JSON('toe', '<?php echo $this->url(array('module' => 'user', 'controller' => 'friends', 'action' => 'suggest'), 'default', true) ?>', {
'minLength': 1,
'delay' : 250,
'selectMode': 'pick',
'autocompleteType': 'message',
'multiple': false,
'className': 'message-autosuggest',
'filterSubset' : true,
'tokenFormat' : 'object',
'tokenValueKey' : 'label',
'injectChoice': function(token){
if(token.type == 'user'){
var choice = new Element('li', {
'class': 'autocompleter-choices',
'html': token.photo,
'id':token.label
});
new Element('div', {
'html': this.markQueryValue(token.label),
'class': 'autocompleter-choice'
}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', token);
}
else {
var choice = new Element('li', {
'class': 'autocompleter-choices friendlist',
'id':token.label
});
new Element('div', {
'html': this.markQueryValue(token.label),
'class': 'autocompleter-choice'
}).inject(choice);
this.addChoiceEvents(choice).inject(this.choices);
choice.store('autocompleteChoice', token);
}
}
, onPush : function(){
}
});