當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AutoComplete::init方法代碼示例

本文整理匯總了PHP中yii\jui\AutoComplete::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP AutoComplete::init方法的具體用法?PHP AutoComplete::init怎麽用?PHP AutoComplete::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\jui\AutoComplete的用法示例。


在下文中一共展示了AutoComplete::init方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     Html::addCssClass($this->options, 'form-control');
     if (!array_key_exists('onfocus', $this->options)) {
         $this->options['onfocus'] = 'jQuery(this).autocomplete(\'search\');';
     }
     $this->clientOptions = array_merge($this->clientOptions, ['source' => $this->source, 'minLength' => $this->minLength]);
 }
開發者ID:ivan-chkv,項目名稱:yii2-jui-autocomplete,代碼行數:12,代碼來源:AutoComplete.php

示例2: init

    public function init(){

        $this->clientOptions =[
            'source' => $this->url,
            'minLength' => 1,
            'select' => new JsExpression('function(event, data) {$("#'.$this->id.'").val(data.item.name);$(this).attr("data-id",data.item.id);return false;}'),
            'focus' => new JsExpression('function(event,data){$(this).val(data.item.name);$(this).attr("data-id",data.item.id);return false;}'),
        ];

        $this->renderItem = new JsExpression('.autocomplete("instance")._renderItem = function( ul, item ) {
                        return $("<li></li>")
                        .data("item.autocomplete", item)
                        .append("<a>" + item.name + "<br><img src =" + "http://localhost/Auction/auction/web/uploads/products/thumbs/index1441177480.jpeg" + "></img></a>")
                    .appendTo(ul);
                };'
        );

        parent::init();

    }
開發者ID:harish-reglobbe,項目名稱:Auction,代碼行數:20,代碼來源:AutoComplete.php

示例3: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->visibleOptions["id"])) {
         $this->visibleOptions["id"] = $this->options["id"] . "-visible";
     }
     if (empty($this->clientOptions['select'])) {
         $this->clientOptions['select'] = new JsExpression("function(event, ui) {\n\n                    var hiddenVal = ui.item.id ? ui.item.id : ui.item.value;\n\n                    \$('#{$this->options["id"]}').val(hiddenVal);\n\n            }");
     }
     if (empty($this->clientOptions['change'])) {
         $this->clientOptions['change'] = new JsExpression("function(event, ui) {\n\n                    var val = \$(event.currentTarget).val();\n\n                    if(!val)\n                        \$('#{$this->options["id"]}').val('');\n\n            }");
     }
     if ($this->liveSync) {
         $this->view->registerJs("\n\n                \$('#{$this->visibleOptions["id"]}').on('keyup', function(){\n\n                    \$('#{$this->options["id"]}').val(\$(this).val());\n\n                });\n\n            ");
     }
     if ($this->hasModel() and $this->visibleAttribute === null) {
         $this->visibleAttribute = $this->attribute;
     } elseif ($this->visibleValue === null) {
         $this->visibleValue = $this->value;
     }
 }
開發者ID:frostiks25,項目名稱:rzwebsys7,代碼行數:24,代碼來源:AutoComplete.php

示例4: init

 public function init()
 {
     $url = Url::to($this->route);
     $this->clientOptions['source'] = new JsExpression("function(request, response) {\n            \$.getJSON('{$url}', {\n                search: request.term\n            }, response);\n        }");
     parent::init();
 }
開發者ID:kissarat,項目名稱:tornados.su,代碼行數:6,代碼來源:AjaxComplete.php


注:本文中的yii\jui\AutoComplete::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。