bupy7/yii2-gridify-view

This package is abandoned and no longer maintained. No replacement package was suggested.

This is widget extended of ListView with plugin of https://github.com/hongkhanh/gridify. This widget allows load content automatically via Ajax when you reach the end of the page. Content is displayed in table form.

Installs: 169

Dependents: 0

Suggesters: 0

Security: 0

Stars: 23

Watchers: 4

Forks: 8

Open Issues: 0

Type:yii2-extension

1.0.1 2018-05-07 08:14 UTC

This package is not auto-updated.

Last update: 2020-08-16 11:34:52 UTC


README

This is widget extended of ListView with plugin of https://github.com/hongkhanh/gridify. This widget allows load content automatically via Ajax when you reach the end of the page. Content is displayed in table form.

Screenshot

Installation

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require bupy7/yii2-gridify-view "dev-master"

or add

"bupy7/yii2-gridify-view": "dev-master"

to the require section of your composer.json file.

How use

Added in your controller following code:

public function actionIndex()
{
    $searchModel = new ModelSearch();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

    if (Yii::$app->request->isAjax) {
        return $this->renderPartial('_page', [
            'dataProvider' => $dataProvider,
            'onlyItems' => true,
        ]);
    }

    return $this->render('index', [
        'dataProvider' => $dataProvider,
        'searchModel' => $searchModel,
    ]);
}

Added in your index view following code:

$this->render('_page', [
    'dataProvider' => $dataProvider,
]);

Added in your _page view following code:

use bupy7\gridifyview\GridifyView;

echo GridifyView::widget([
    'dataProvider' => $dataProvider,
    'itemView' => '_item',
    'onlyItems' => isset($onlyItems) ? $onlyItems : false,
    'pluginOptions' => [
        'url' => ['/path/to/actin/in/your/controller'],
        'srcNode' => '> div',
        'resizable' => true,
        'width' => '250px',
        'maxWidth' => '350px',
        'margin' => '20px',
    ],
    'events' => [
        'afterLoad' => 'function(){
            alert('Successfully!');
        }',
    ],
]);

License

yii2-gridify-view is released under the BSD 3-Clause License.