Yii2-Simple-Filter icon indicating copy to clipboard operation
Yii2-Simple-Filter copied to clipboard

Can you share the any running example with code.

Open mohdbashir opened this issue 9 years ago • 5 comments

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.

mohdbashir avatar Mar 30 '15 11:03 mohdbashir

no additional errors in console? show me, please, your yii2 config (urlManager)

sanex3339 avatar Mar 30 '15 17:03 sanex3339

return [ 'class'=>'yii\web\UrlManager', 'enablePrettyUrl'=>true, 'showScriptName'=>false, 'rules'=> [ ['pattern'=>'page/', 'route'=>'page/view'] ] ];

mohdbashir avatar Mar 31 '15 04:03 mohdbashir

#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', ]); ?>

mohdbashir avatar Mar 31 '15 04:03 mohdbashir

Hmm. Strange bug. What browser you have? Module not work with old browser (ie8, ie9)

sanex3339 avatar Mar 31 '15 20:03 sanex3339

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

  1. country
  2. 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.

rahulsinh avatar Jul 02 '15 12:07 rahulsinh