Git Product home page Git Product logo

hdushku / yii2-gridify-view Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bupy7/yii2-gridify-view

0.0 0.0 0.0 1.48 MB

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.

License: BSD 3-Clause "New" or "Revised" License

PHP 44.65% JavaScript 55.35%

yii2-gridify-view's Introduction

yii2-gridify-view

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.

yii2-gridify-view's People

Contributors

bupy7 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.