Git Product home page Git Product logo

select-tree's Introduction

laravel-admin select-tree

select-tree 是针对laravel-admin 数据模型树 的 select 联动选择插件, 可集成至表单中,或用于筛选。

单选效果

单选效果

多选效果

多选效果

安装

composer require zhpefe/select-tree

使用

$filter->selectTree(column, {label})->ajax(URL)->topId(1);
$form->selectTree(column, {label})->ajax(URL)->topId(1);
$form->multipleSelectTree(column, {label})->ajax(URL)->topId(1);
  • 需要用ajax方法指定AJAX的地址,select的change触发后会GET此地址,并把当前选项的值通过参数q传递, 返回的数据结构为:
{
    "myself": {
        "id": 2,
        "parent_id": 1,
        "title": "xxx"        
    },
    "siblings": [
        {
            "id": 2,
            "parent_id": 1,
            "title": "xxx"
        },
        ...
    ],
    "children": [
        {
            "id": 8,
            "parent_id": 2,
            "title": "xxx",
        },
        ...
    ]
}

其中 myself 代表自身, siblings表示同级, children 为子类。

  • topId() 方法为指定顶级ID,默认为0;

select-tree's People

Contributors

z-perfe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.