Giter Site home page Giter Site logo

laravel-tree-table's Introduction

Tree-table for laravel-admin

ScreenShot

Install

composer require laravel-admin-ext/tree-table
php artisan vendor:publish --provider=Encore\TreeTable\TreeTableServiceProvider

Update

composer require laravel-admin-ext/tree-table
php artisan vendor:publish --tag=tree-table --force

Configurations

Add extensions option in your config/admin.php configuration file:

'extensions' => [
    'data-table' => [
        // If the value is set to false, this extension will be disabled
        'enable' => true,
        // global options
        'options' => [
             'paging' => false,
             'lengthChange' => false,
             'searching' => false,
             'ordering' => false,
             'info' => false,
             //'language' => 'English', // or Chinese //因没有语言包,这个可不要
        ]
    ]
]

Use

use Encore\TreeTable\TreeTable;

// table
$urls = ['create'=>'dict/create'];
$headers = [['field'=>'id','title'=>'ID'],['field'=>'code','title'=>'字典编码'],['field'=>'name_cn','title'=>'字典名称'],['field'=>'status','title'=>'状态'],['field'=>'operate','title'=>'操作']];

$dictList = Dict::with('allChildrenDicts')->paginate();//从数据库获取数据

$columns = ['id', 'code', 'name_cn', 'status', 'operate'];
        $style = ['table-bordered','table-hover', 'table-striped'];
        $options = [
            'paging' => true,
            'lengthChange' => false,
            'searching' => false,
            'ordering' => true,
            'info' => true,
            'autoWidth' => false,
        ];
$formats = ['status'=>['0'=>'禁用','1'=>'启用']];
$operates = [['cls'=>'edit', 'url'=>'dict/%s/edit'], ['cls'=>'trash', 'url'=>'dict/%s/delete']];

$treeTable = new TreeTable($urls, $headers, $columns, $dictList->items(), $style, $options, $formats, $operates);

return $content->header('字典管理')
            ->body($treeTable->render());

More resources

Laravel-admin-tree-table

License

laravel-tree-table's People

Watchers

 avatar

laravel-tree-table's Issues

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.