[GridView]--index page rewrite

Source: Internet
Author: User
Tags yii

lulucms Post Module index page source code



<?php use yii\helpers\html;
Use Source\core\grid\gridview;
Use Source\lulu;
Use source\models\content;

Use source\libs\constants; /* @var $this Yii\web\view *//* @var $searchModel app\models\search\contentsearch */* @var $dataProvider Yii\data\activ
Edataprovider */$type = ' post ';
$this->title = ' article management ';


$this->params[' breadcrumbs ' [] = $this->title; ?> <?php $this->toolbars ([Html::a (' New One ', [' Create '], [' class ' = ' = ' btn btn-xs btn-primary mod-site-save ') ]), html::a (' Settings ', [' Setting/index '], [' class ' = ' btn btn-xs btn-primary mod-site-save ']); > <?= gridview::widget ([' Dataprovider ' + $dataProvider,//' filtermodel ' and ' = ' $searc
                Hmodel,//Set layout ' layouts ' = ' {Items}\n{pager} ', ' columns ' = [[ ' Class ' = ' Source\core\grid\idcolumn ',], [' attribute ' = ' t Itle ', ' headeroptions ' =>
          
            [' width ' = ' auto '],//headeroptions can set the table caption HTML property. If the modified content is Contentoptions property], such as with height,
            [' class ' = ' Source\core\grid\datetimecolumn ', ' attribute ' = ' updated_at ', ],//' allow_comment ',//' comments ', ' usertext ', ' comment_count ', ' View_count ', [' attribute ' = ' status ', ' width ' = ' 25px ', ' Content ' =>function ($model, $key, $index, $gridView) {return constants::getstatusitemsforcontent ($model
                ->status);
            },],//' Diggs ',//' Burys ',//' sticky ',//' password ',
            ' Visibility ',//' status ',//' thumb ',///' Alias ',

       ' Excerpt ',//' content:ntext ',//' content_type ',//' template ',     [' class ' = ' Source\core\grid\actioncolumn '],],?>                
             
            


Idcolumn Source Code

<?php
namespace Source\core\grid;

Class Idcolumn extends DataColumn
{public
    $attribute = ' id ';
    Public $headerOptions =[' width ' = ' 25px '];//set the id column width
    //public $contentOptions =[' width ' = ' 25000px '];

    Public function init ()
    {
        parent::init ();
    }
}


DataColumn Source Code

<?php
namespace Source\core\grid;

Class DataColumn extends \yii\grid\datacolumn
{public

    $headerOptions = [];

    Public $width = ' 60px ';

    Public function init ()
    {
        parent::init ();
        
        if (! isset ($this->headeroptions[' width '))
        {
            $this->headeroptions[' width '] = $this->width;
        }
        $this->contentoptions=[' style ' = ' word-wrap:break-word; word-break:break-all; ';
    }
}

Datetimecolumn Source Code

<?php
namespace Source\core\grid;

Class Datetimecolumn extends DataColumn
{public
    $headerOptions =[' width ' = ' 120px '];//This is the setting index Time column width public
    
    $format =[' datetime ', ' php:y-m-d h:m:s '];

    Public function init ()
    {
        parent::init ();
    }
}




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.