artflow-studio/laravel-dynamic-datatable 问题修复 & 功能扩展

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

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

artflow-studio/laravel-dynamic-datatable

最新稳定版本:v3.2

Composer 安装命令:

composer require artflow-studio/laravel-dynamic-datatable

包简介

A Laravel package for dynamic datatables.

README 文档

README

Laravel Dynamic Datatable is a package that simplifies the integration of dynamic datatables into your Laravel application using Blade directives. It provides features like export buttons, column visibility toggling, search functionality, custom rendering, and class assignment to columns.

Features

  • Export Button
  • Column Visibility
  • Search Input
  • Custom Render Function
  • Custom Class Assignment to Column

Installation

Install the package using Composer:

composer require artflow-studio/laravel-dynamic-datatable

Publish the package assets

php artisan vendor:publish --tag=AF_dtable --force

Include Styles and Scripts

Add the following stack directives in your Blade template to include the required styles and scripts:

<head>
    <!-- Other head elements -->

    @stack('AF_dtable.css')
</head>

At the end of the body tag:

<body>
    <!-- Your HTML content -->

    @stack('AF_dtable.js')
</body>

Blade Directives Usage

  • Header for Search Export and Column Visibility Buttons
@AF_dtable_btns(['search' => true, 'colvis' => true, 'export_btn' => true])
  • HTML Code for Table (must below the AF_dtable_btns)
    <table id="myTable">
        <thead>
            <tr>
                <th>Col1</th>
                <th>Col2</th>
                <th>Col3</th>
            </tr>
        </thead>
    </table>
  • DataTable Initialization Code
@AF_dtable([   
    'id' => 'myTable',                      //the id of the table 
    'route' => 'my.route.name',             //Route name from Web.php
    'cols' => ['col1' , 'col2', 'col3'],    // column names from the controller
        ])

Other Options (Optional)

'info' => 'true',
'index' => '1', // For Multiple tables in Single View
'pageLength' => '50',
'order' => ['0', 'asc'],
'processing' => 'true',
'serverside' => 'true',
'select' => 'true',
'hide_cols' => [0,1,2,3,4,5],
'cols_class' => [
    ['0','your-class-name'],['1','your-class-name'],
    ],
'render' => [
            //Returning Column Data in a Mailto Anchor Tag 
            // "${data}" is the actual data returning from Database  
        ['col' => 5, 'html' => '<a href="mailto:${data}">${data}</a>']
        ],

Authors

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-19