Kartik Yii2 Typeahead Widget event listener not working -
i have kartik yii2 typeahead widget in view:
echo \kartik\typeahead\typeahead::widget([ 'name' => 'serial_product', 'options' => [ 'placeholder' => 'product name / sku / serial number / coupon code', 'autofocus' => "autofocus", 'id' => 'serial_product' ], 'scrollable' => true, 'pluginoptions' => [ 'highlight' => true, 'minlength' => 3 ], 'dataset' => [ [ 'remote' => [ 'ttl' => 0, 'url' => url::to(['invoice/ajaxgetinventoryitemsnew']) . '?search=%query', 'ajax' => ['complete' => new \yii\web\jsexpression("function(response){jquery('#serial_product').removeclass('loading');checkresult(response.responsetext);return true}")] ], 'limit' => 10 ] ], 'pluginevents' => [ "typeahead:selected" => "function(obj, item) { checkresult2(item); return true; }", "typeahead:render" => "function() { console.log('whatever...'); }", ], ]);
the first "pluginevents" (typeahead:selected) getting triggered should. 2nd 1 "typeahead:render" not triggered, , no error on console.
why render event not triggered?
versions: typeahead.js 0.10.5 | kartik typeahead.php 1.0.0
maybe: use kartik\widgets\typeahead
$data = [ 'alabama', 'alaska', 'arizona', 'arkansas', 'california', 'colorado', 'connecticut', 'delaware', 'florida', 'georgia', 'hawaii', 'idaho', 'illinois', 'indiana', 'iowa', 'kansas', 'kentucky', 'louisiana' ]; // usage activeform , model (with search term highlighting) echo \$form->field(\$model, 'state_3')->widget(typeahead::classname(), [ 'options' => ['placeholder' => 'filter type ...'], 'pluginoptions' => ['highlight'=>true], 'dataset' => [ [ 'local' => $data, 'limit' => 10 ] ] ]);
Comments
Post a Comment