tonisormisson/yii1-querybuilder 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tonisormisson/yii1-querybuilder

Composer 安装命令:

composer require tonisormisson/yii1-querybuilder

包简介

jQuery Query-builder widget for Yii1

README 文档

README

This is an implementation of jQuery Querybuilder for Yii1

DEMO

https://demo.andmemasin.eu/yii1-querybuilder/

Dependencies

this widget depends on jQuery and Bootstrap3. Due to Yii1 widgets logic the widget itself does not manage the dependencies. You need to install & load the jQuery and Bootstrap3 in your app yourself prior using this widget!

Basic usage example

In view:

echo CHtml::beginForm();
$this->widget('ext.yii1-querybuilder.QueryBuilder',
    [
        'model'=>$model,
        'attribute'=>'myquerystring',
        'filters'=>[
            ['id'=>'name','label'=>'Name (string)','type'=>'string'],
            ['id'=>'age','label'=>'Age (integer)','type'=>'integer'],
            ['id'=>'height','label'=>'Height (double)','type'=>'double'],
            ['id'=>'birthday','label'=>'Birthday (date)','type'=>'date'],
            ['id'=>'time','label'=>'Time (time)','type'=>'time'],
            ['id'=>'changed_at','label'=>'Last changed (datetime)','type'=>'datetime'],
            ['id'=>'is_active','label'=>'Is Active? (boolean)','type'=>'boolean'],
        ],
        'rules'=>$rules,

    ]);

echo CHtml::submitButton('go');
echo CHtml::endForm();

In Controller:

public function actionIndex()
{
    $model = new SomeModel();
        if(isset($_POST['SomeModel'])){
            $model->attributes =$_POST['SomeModel'];
            $rules = json_decode($someModel->myquerystring);
            if($rules){
                Yii::import('application.extensions.yii1-querybuilder.Translator');
                // translate rules to SQL (with params)
                $translator = new Translator($rules);
                // feed the translated sql & params to Yii find() method
                $result = SomeModel::model()->find($translator->where, $translator->params);
            }
        }
        $this->render('index',[
            'rules'=>$rules,
        ]);
}

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固