コード例 #1
0
ファイル: index.php プロジェクト: akula22/fifa
    <p>
        <?php 
echo Html::a('Создать запись', ['create'], ['class' => 'btn btn-success']);
?>
    </p>
    
    <?php 
Pjax::begin();
?>
    <?php 
echo himiklab\sortablegrid\SortableGridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'id' => 'post_tbl', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['class' => CheckboxColumn::classname()], ['attribute' => 'title', 'format' => 'html', 'value' => function ($model) {
    return Html::a($model['title'], ['update', 'id' => $model['id']]);
}], ['attribute' => 'cat_id', 'content' => function ($data) {
    return $data->getCategoryName();
}, 'filter' => \yii\helpers\Arrayhelper::map(\app\modules\category\models\Category::find()->all(), 'id', 'title')], ['attribute' => 'created_at', 'format' => ['date', 'dd.MM.yyyy'], 'options' => array('width' => '225px'), 'filter' => \yii\jui\DatePicker::widget(['dateFormat' => 'dd.MM.yyyy', 'model' => $searchModel, 'attribute' => 'created_at', 'options' => ['class' => 'form-control'], 'clientOptions' => ['dateFormat' => 'dd.mm.yy']])], ['attribute' => 'status', 'format' => 'html', 'value' => function ($model) {
    $class = $model->status === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-lock">';
    return $class;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'status', array(1 => 'On', 0 => 'Off'), ['class' => 'form-control', 'prompt' => 'Все'])], ['attribute' => 'main', 'format' => 'html', 'value' => function ($model) {
    $res = $model->main === 1 ? '<i class="icon-ok"></i>' : '<i class="icon-minus">';
    return $res;
}, 'options' => array('width' => '100px'), 'filter' => Html::activeDropDownList($searchModel, 'main', array(1 => 'Да', 0 => 'Нет'), ['class' => 'form-control', 'prompt' => 'Все'])], 'username', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '100']]]]);
?>

<p> 
  <?php 
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
?>
  
</p>

コード例 #2
0
ファイル: index.php プロジェクト: akula22/fifa



<div class="category-index">



    <p>
        <?php 
echo Html::a('Создать категорию', ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo himiklab\sortablegrid\SortableGridView::widget(['id' => 'cat_tbl', 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => \yii\grid\CheckboxColumn::classname()], ['attribute' => 'id', 'label' => '#ID', 'format' => 'raw', 'options' => array('width' => '50px'), 'value' => function ($data) {
    return Html::a($data->id, ['update', 'id' => $data->id]);
}], ['attribute' => 'title', 'label' => 'Название / Подкатегория', 'format' => 'text', 'content' => function ($data) {
    return $data->getParentName();
}], 'slug', ['class' => 'yii\\grid\\ActionColumn', 'header' => 'Действия', 'headerOptions' => ['width' => '120']]]]);
?>
<p> 
  <?php 
echo Html::a('Удалить выбранные', ['massdelete'], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Вы уверены?', 'data-method' => 'post']]);
?>
  
</p>
</div>
<?php 
$js = "\$('.btn').on('click', function() \n    {\n        \$.post(\n            \"massdelete\", {\n                selection : \$('#cat_tbl').yiiGridView('getSelectedRows')\n            },\n            function () {\n                \$.pjax.reload({container:'#w0-container'});\n            }\n        )\n    }\n)";
$this->registerJs($js, $this::POS_READY);