定制 plesk/yii2-standalone-search-form 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

plesk/yii2-standalone-search-form

Composer 安装命令:

composer require plesk/yii2-standalone-search-form

包简介

Plesk extension for Yii2 framework to make standalone search forms.

README 文档

README

This extension provides an ability to create a form that will be submitted and validated via PJAX. After submitting the form, the page fragment set in the form settings will be updated via PJAX. Such approach provides an ability to create ajax forms with validation without the need to implement Yii2 forms AJAX validation and Yii2 client validation. The form is adaptive.
This extension uses yiisoft/yii2-bootstrap4 extension.

Installation

The preferred way to install this extension is through composer:

composer require "plesk/yii2-standalone-search-form:^2.0.0"

Configuration

[
    'components' => [
        'pjax' => [
            'class' => 'plesk\yii2pjax\Component',
        ],
    ],
]

API

Examples:

use plesk\standalonesearchform\SearchForm;

echo SearchForm::widget([
    'model' => $searchModel,
    'fields' => [
        [
            'type' => 'widget',
            'attribute' => 'project_id',
            'width' => 'full-wide',
            'options' => [
                Chosen::className(),
                [
                    'items' => ArrayHelper::map($projects, 'id', 'name'),
                ]
            ]
        ],
        [
            'type' => 'checkbox',
            'attribute' => 'showCasesCount',
            'width' => 'full-wide',
            'options' => [[], false]
        ],
    ],
    'resultAreaPjaxOptions' => ['id' => 'result-area-pjax-grid', 'timeout' => 1000],
]);
use plesk\standalonesearchform\SearchForm;

echo SearchForm::widget([
    'model' => $searchModel,
    'collapse' => true,
    'fields' => [
        [
            'type' => 'widget',
            'attribute' => 'project_id',
            'width' => 'full-wide',
            'options' => [
                Chosen::className(),
                [
                    'items' => ArrayHelper::map($projects, 'id', 'name'),
                ]
            ]
        ],
        [
            'type' => 'widget',
            'attribute' => 'dateCreated',
            'width' => 'long',
            'range' => true,
            'options' => [
                DateTimePicker::className(),
            ]
        ],
    ],
    'resultAreaPjaxOptions' => ['id' => 'plesk-pjax-search-result', 'timeout' => 30000],
    'buttons' => [
        [
            'type' => 'submitButton',
            'options' => [
                'Search it!',
                ['class' => 'btn btn-primary'],
            ]
        ],
        [
            'type' => 'widget',
            'options' => [
                \app\components\widgets\clearButton\Widget::class,
                [
                    'content' => 'Clear it!',
                    'buttonOptions' => ['class' => 'btn btn-danger'],
                ],
            ]
        ]
    ],
]);

See SearchForm class for details

To handle pjax errors you should setup your handler before calling this widget.

<head>
    <?php
        $this->registerJs(
            '$(document).on(\'pjax:error\', function(event, xhr, textStatus, error, options) {
                pleskMessageBox.options.title = error;
                pleskMessageBox.alert(xhr.responseText);
            });'
        );
    ?>
</head>

Exceptions

- plesk\standalonesearchform\exceptions\Exception

    All exceptions thrown by the extension, extend this exception.

统计信息

  • 总下载量: 87
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 22
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2020-04-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固