S
S
Skrolea2016-07-12 12:35:07
JavaScript
Skrolea, 2016-07-12 12:35:07

Why are photos from another section shown?

I already asked a question here, but poorly formulated.

We have a photo, the paths to which are stored in the database like this

| id | name | action |
|1| photo1 | 1 |
|2| photo2 | 2 |

actionis the number of the section in which the photos should be shown. To display photos, I use the
kop/yii2-scroll-pager plugin for which I prepare dataprovider in the controller
public function actionPhotos() {
        $params = Yii::$app->request->queryParams;
        $searchModel = new PhotosSearch();
        $dataProvider = $searchModel->search($params);
        return $this->render('photos', [
                    'searchModel' => $searchModel,
                    'dataProvider' => $dataProvider                 
        ]);
    }

$params is the number of the section in which you want to show the photo. I get it when the user clicks on the section link, for example 'url' => '/photos/2'
Photos are displayed in the view using
echo ListView::widget([
                    'dataProvider' => $dataProvider,
                    'itemOptions' => ['class' => '.item'],
                    'itemView' => '_item_view',
                    'pager' => ['class' => ScrollPager::className(),
                        'enabledExtensions' => [
                            ScrollPager::EXTENSION_TRIGGER => 1000,
                            ScrollPager::EXTENSION_PAGING,
                            ScrollPager::EXTENSION_NONE_LEFT,
                            ScrollPager::EXTENSION_SPINNER => false],
                        'spinnerTemplate' => '<div class="ias-spinner" style="text-align: center; z-index:1800; color:red;"><img src="{src}"/></div>',
                        'noneLeftText' => ''
                    ],
                ]);
Well_item_view
<div class="col-md-4 col-xs-12 col-sm-6 item ">
    <a href="" class="photo_url" data-toggle="modal" data-img-url="<?= '/' . $model->url ?>" data-target="#foto">
        <img class="img-responsive thumbnail" src="<?= '/' . $model->thumb ?>" alt="">
    </a>   
</div>

And everything worked great. But at some point, when some sections were displayed in the photo, photos from other sections began to fall. For no reason Some are stored in the database, while others are displayed. At the same time, in the admin panel (there is just a gridview output) - they are displayed correctly, each photo in its own section. But on the frontend, everything is wrong. Where to dig then? Is something cached somewhere? That's why I marked jQuery in the question tags, because I don't know where to dig anymore. Those. everything is ok in the server part, but it is displayed incorrectly like this.
Clearing assets didn't help. The first three photos from the correct section are displayed, then 9 photos from the wrong one, and then the rest again from the correct one

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question