这是我的模特搜索:
public function search($params)
{
$query = "select distinct number,
id,
write_date::date,
customer_id,
customer_name,
sales.name,
sales.id as sales_id
from item
inner join sales on sales.id = pa.sales_id
where status = 'oke'
order by write_date::date
";
// add conditions that should always apply here
$dataProvider = new SqlDataProvider([
'sql' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
return $dataProvider;
}
这个模型搜索工作正常,可以在gridview上加载数据,但过滤它不起作用。谁能帮我?感谢。