Yii2-Simple-Filter
Yii2-Simple-Filter copied to clipboard
Can you share the any running example with code.
I have setup the installation and filter is showing on the page but simple-filter-ajax not call and giving error in console. i think ajax request is not working.
Giving error in console:
"
http://example.local/simple-filter-ajax?page=1&...ter=1&categories%5B0%5D=54f57c6eae67a2bd315202d4
jquery.js (line 8625)
TypeError: href is undefined
if (href.charAt(0) == '&') "
Please share the running example code.
no additional errors in console? show me, please, your yii2 config (urlManager)
return [
'class'=>'yii\web\UrlManager',
'enablePrettyUrl'=>true,
'showScriptName'=>false,
'rules'=> [
['pattern'=>'page/
#DealController
use sanex\simplefilter\SimpleFilter; class DealController extends Controller {
public function actionFinds(){ $searchModel = new DealSearch(); $dataProvider = $searchModel->searchDeals(Yii::$app->request->queryParams); $ajaxViewFile = '@frontend/views/deal/find-ajax';
$filter = SimpleFilter::getInstance();
$filter->setParams([
'ajax' => true,
'model' => $searchModel,
//'query' => $dataProvider,
'useCache' => true,
'useDataProvider' => true,
]);
return $this->render('finds', ['filter' => $filter,'ajaxViewFile'=>$ajaxViewFile,'dataProvider' => $dataProvider,'searchModel'=>$searchModel]);
}
}
#frontend/views/deal/finds.php
= $filter->setFilter([ [ 'property' => 'category_id', 'caption' => 'CATEGORIES', 'values' => \yii\helpers\ArrayHelper::map(Category::find()->all(),function ($searchModel){return $searchModel->_id->__toString();},'_id'), 'class' => 'horizontal', ], ]); ?> = $filter->renderAjaxView($ajaxViewFile,['dataProvider' => $dataProvider]); ?>#frontend/views/deal/find-ajax.php
$dataProvider,
'itemOptions' => ['class' => 'item'],
'itemView' => '_find_view',
]);
?>
Hmm. Strange bug. What browser you have? Module not work with old browser (ie8, ie9)
hii @sanex3339 i am also using this extension installation and set up is ok it is working good but i have some question i have two filter
- country
- city
when i select country india then automatically remove values of cities those are not belong to india
for example i am click on india the show only indian city for second filter.