Hi,
Lets say I have some array and as I type something in search it shows only those array values that contain my entry. I cant figure out how to do it and cant find a good article about it. I would appreciate if you would give me some links or give some example.
Thanks
Hello,
Here’s a working example what you want.
Now I want to know to how to do it…
http://demos.krajee.com/grid-demo
khushal
(Khushal Fadiya)
June 3, 2014, 1:01pm
3
You can make your code like this :
<?php echo $form->dropDownList($model,‘field_name’,CHtml::listData($data,‘id’,‘value’),array(‘empty’ => ‘All’)); ?>
You can make your code like this :
<?php echo $form->dropDownList($model,‘field_name’,CHtml::listData($data,‘id’,‘value’),array(‘empty’ => ‘All’)); ?>
CHtml is sooo Yii1 or isn’t it…
Still need a better example for this to work… Where to place this code view/invoice/_search.php ?
And will it still work with my code added in models/invoiceSeach where it looks for a customer when typing in the Searchfield.
$query->andFilterWhere(['like', 'customers.customername', $this->customer]);
(In my model invoice I’v allready added the customer relation)
public function getCustomer()
{
return $this->hasOne(customers::className(), ['id' => 'customer_id']);
}
So a step bij step Yii2 tutorial would be real nice!
thiagoc7
(Thiagobocorrea)
June 3, 2014, 3:55pm
5
You have to use a widget, like select2 or selectize.
Than it’s as easy as a regular dropdown
Yes!! those, did you get them to work in the search box?
If you did plaese provide the samples!
Where to add the code in which controllers/files!!