Pagination re-visit

Got the paginator working, but a problem, please see this screenshot of yii2 and notice page 1

https://drive.google.com/file/d/0B1_PFw--3o74RFUzR2lnOUU2U2M/view?usp=sharing

then see this screen of laravel

https://drive.google.com/file/d/0B1_PFw--3o74SVdQX3BJZXVzbk0/view?usp=sharing

page 1 is correct. I do use custom css, but have the active class. It is




.active {

    background-color: #687282;

    border: 1px solid #D5D5D5;

    color: #ffffff;

    font-size: 12px;

    font-weight: bold;

    height: 25px;

    padding: 8px 8px;

    text-decoration: none;

    margin:2px;

}



In cakephp or laravel I have no trouble with my custom css for pagination, but why isn’t yii2 displaying correct. Furthermore in yii2 it is still an active link. Yet I checked the api and the “active” class is correct.

Does the yii\widgets\LinkPager do something with css that’s off the beaten path?

Laravel uses bootstrap, I believe Yii2 also, so if I can use my css in laravel then it should work in yii2, correct?

At least throw me a bone, so far I like yii2, but things like this are irritating.

Here is the method, notice I am starting with 0 as per the docs.




public function actionDlist()

    {

        $sch = Yii::$app->request->get('sch', 'c');

        $schquy = $sch . "%";

        $page = Yii::$app->request->get('page', '1');

        $perpage = "5";

        $offset = ($page - 1) * $perpage;

        $page = $page - 1;

        $count = Dog::find()->where(['like', 'dogname', $schquy, false])->count();


        $pages = new Pagination(['totalCount' => $count, 'defaultPageSize' => 5, 'params' => array('sch' => $sch)]);

        $pages->setPage($page);

        $dogs = Dog::find()->where(['like', 'dogname', $schquy, false])

                ->offset($offset)

                ->limit($perpage)

                ->all();

        $this->layout = 'dog/indextp';

        return $this->render('dlist', [

                    'dogs' => $dogs,

                    'pages' => $pages

        ]);

    }




It works, it paginates, but active class link is messed up.

It is about css question. Open browser console and check what is wrong with your styles.

umneeq there is nothing wrong with the css. I use that exact custom style sheet when paginating in laravel, replaces the bootstrap one that comes with laravel.

So if there are no errors in the way it shows there, that leaves the yii2 link pager.

Somehow something is going wrong, but I know it’s not the css. Also the exact same css works in cakephp.

But I will have a look like you suggested.

Are the sites on the Internet?

Laravel site is on internet, Yii in development server, but there also the same, laravel pagination links work, problem with yii2 paginator active link only.

Do you know where I can get the un-compressed bootstrap pagination css code so I can compare? Never encountered such a problem before.

Just open browser console.

It just shows


<li class="active"><a href="/yii2/dog/dlist?sch=c&amp;page=1" data-page="0">1</a></li>

On the right panel you can play with styles by hand. Set your custom styles until get the needed result

When the page is actually page 1, is it correct to pass 0 to the yii2 paginator?

Hmm, dunno. Try both variant

I tried passing a 1 for page 1 but get page 2, so 0 must be correct.

From docs