我已经尝试了太多方法,但没有找到任何解决方案。
GridView的:
[
'attribute' => 'lbt_book_master_id',
'value' => function($model){
return LibraryBorrowTransaction::getBookName($model->lbt_book_master_id); },
'filter' => LibraryBorrowTransaction::getBN(),
],
方法:
public function getBN()
{
$books_data = (new \yii\db\Query())
->select(["lbd_title as value","lbd_id as id"])
->from('lib_book_master lbm')
->join('join','lib_book_details lbs','lbm.lbm_book_details_id = lbd_id')
->join('join', 'lib_borrow_transaction lbt', 'lbm.lbm_book_no = lbt_book_master_id')
->where('lbm.lbm_book_no = lbt.lbt_book_master_id')
->groupBy('lbd_id')
->all();
$data = ArrayHelper::map($books_data, 'id', 'value');
return $data;
}
为什么过滤器不起作用?