简体   繁体   中英

In TokenInput, I want the resultformatter to display “No result” when the user typing data is not available?

<div class="row">
     <div class="floatleft" style="width:110px;"><?php echo CHtml::label('TO :','',array('class'=>'label_name',));?></div>
       <div class="floatleft"><?php $this->widget('application.extensions.tokeninput.TokenInput', array(
    'model' => $model,
    'attribute'=>'TO',
    'id'=>'TO',

    'url' => $this->createUrl('User/autocomplete'),
    'options' => $arrOptions
    )
); ?></div>

$arrOptions['allowCreation'] = true;
$arrOptions['preventDuplicates'] = true;
$arrOptions['resultsFormatter'] ='js:function(item){ 

    return "<li><p>" + item.name + "</p></li>" 
    }';
$arrOptions['theme'] = 'facebook';

I have a token input for a list of user names, when one type a name which does not exist I want to display "No result found", I know I have to change resultsFormatter , but I don't know how to check the existing data with the term item?

很好的数据本身会通过插件检查,但是如果您要更改“未找到结果”使用选项的文本

noResultsText: "Alternate No Results found"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM