本文整理汇总了PHP中yii\grid\DataColumn::init方法的典型用法代码示例。如果您正苦于以下问题:PHP DataColumn::init方法的具体用法?PHP DataColumn::init怎么用?PHP DataColumn::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\DataColumn
的用法示例。
在下文中一共展示了DataColumn::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @inheritdoc
*/
public function init()
{
$script = <<<JS
jQuery(document).on('click', '.order-link', function(e) {
e.preventDefault();
var csrfToken = \$('meta[name="csrf-token"]').attr("content");
var url = jQuery(this).attr('href');
var obj = this;
jQuery.ajax({
method: 'post',
url: url,
data: {_csrf: csrfToken},
success: function(data) {
jQuery('#'+jQuery( obj ).closest( ".grid-view" ).attr('id')).yiiGridView("applyFilter");
}
});
});
JS;
$view = $this->grid->getView();
GridViewAsset::register($view);
$view->registerJs($script);
parent::init();
// TODO: Change the autogenerated stub
}
示例2: init
public function init()
{
parent::init();
if (!isset($this->headerOptions['width'])) {
$this->headerOptions['width'] = $this->width;
}
}
示例3: init
public function init()
{
parent::init();
if (!$this->filter) {
$this->filter = \yii\helpers\ArrayHelper::map(\skeeks\cms\models\CmsSite::find()->all(), 'code', 'name');
}
}
示例4: init
public function init()
{
parent::init();
$this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
return Html::a($model->{$column->attribute}, ['view', 'id' => $model->primaryKey], ['title' => Yii::t('common', 'View')]);
};
}
示例5: init
public function init()
{
if (!Yii::$app->getRequest()->getIsAjax()) {
DropdownAsset::register($this->grid->getView());
}
parent::init();
}
示例6: init
/**
* Init
*/
public function init()
{
parent::init();
$this->setDefaultOptions();
$this->setCellStyleOptions();
$this->initOptions();
$this->grid->view->registerJs($this->sortButtonJs());
}
示例7: init
public function init()
{
parent::init();
$model = $this->grid->filterModel;
if ($model) {
$this->filter = $model->getPossibleStatuses();
}
}
示例8: init
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;'];
}
示例9: init
public function init()
{
$this->headerOptions = ['class' => 'text-center', 'style' => 'width: 115px'];
$this->contentOptions = ['class' => 'text-center'];
parent::init();
$this->content = function (ModelBase $model, $key, $index, DataColumn $column) {
return ControllerBase::getYesNoLabel($model->{$column->attribute});
};
}
示例10: init
/**
* @inheritdoc
*/
public function init()
{
if (!isset($this->ajaxOptions['type'])) {
$this->ajaxOptions['type'] = 'POST';
}
$this->ajaxOptions['data'] = new \yii\web\JsExpression('data');
$this->grid->view->registerJs("\$('.editableCell').change(function() {\n data = {};\n data[\$(this).attr('name')] = \$(this).val();\n submitAttributes = \$(this).data('submit-attributes').split(',');\n for (var i in submitAttributes) {\n data[submitAttributes[i]] = \$(this).data('attribute'+i);\n }\n data['dropDownColumnSubmit'] = true;\n \$.ajax(" . \yii\helpers\Json::encode($this->ajaxOptions) . ");\n });");
return parent::init();
}
示例11: init
public function init()
{
parent::init();
if (empty($this->content)) {
$this->content = function ($model) {
/** @var \frontend\modules\torrent\models\Torrent $model */
return Html::a($model->getCategoryTag(), '/search?iht=' . $model->category_id, ['title' => 'Browse ' . $model->getCategoryTag() . ' torrents']);
};
}
}
示例12: init
public function init()
{
parent::init();
if (empty($this->content)) {
$this->content = function ($model) {
/** @var \frontend\modules\torrent\models\Torrent $model */
return Yii::$app->formatter->asShortSize($model->size);
};
}
}
示例13: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (!$this->controller) {
throw new InvalidConfigException("controller - " . \Yii::t('app', "not specified") . ".");
}
if (!$this->controller instanceof AdminModelEditorController) {
throw new InvalidConfigException(\Yii::t('app', "{controller} must be inherited from") . ": " . AdminModelEditorController::className());
}
}
示例14: init
public function init()
{
parent::init();
if (empty($this->content)) {
$this->content = function ($model) {
/** @var \frontend\modules\torrent\models\Torrent $model */
return Yii::$app->formatter->asRelativeTime($model->created_at);
};
}
}
示例15: init
/**
* @inheritdoc
*/
public function init()
{
// Set the filter options based on the info we have
$this->filter = [$this->successValue => $this->successLabel, $this->dangerValue => $this->dangerLabel];
$this->filterInputOptions = ['prompt' => $this->promptLabel, 'class' => 'form-control', 'id' => null];
// Get the view
$view = $this->grid->getView();
ActiveCheckColumnAsset::register($view);
return parent::init();
// TODO: Change the autogenerated stub
}