【问题标题】:autocomplete friends list on socialengine社交引擎上的自动完成好友列表
【发布时间】:2013-07-17 09:12:02
【问题描述】:

如何在具有 2 个不同文本框的页面内使用在社交引擎上撰写消息时使用的自动完成器?

我知道我们可以将它与 id 为“to”的文本框一起使用来完成自动完成工作。但是如何在另一个带有 id eventto 的文本框上使用相同的自动完成功能?

【问题讨论】:

    标签: autocomplete socialengine


    【解决方案1】:

    只需根据要求更改 id (to toe here)

    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(){
            }
          });
    

    【讨论】:

    • 我怎样才能得到所有用户的列表而不是只有朋友?
    猜你喜欢
    • 2018-01-31
    • 1970-01-01
    • 2012-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-26
    相关资源
    最近更新 更多