syntech/syntechtable

用于管理Syntech表格的包。

1.2 2024-08-17 01:06 UTC

This package is auto-updated.

Last update: 2024-09-17 01:28:28 UTC


README

SyntechTable 是一个用于轻松管理和自定义数据表的 Laravel 包。此包基于强大的灵活的数据网格库 AG Grid 构建。

syntechtable

安装

要安装此包,运行

composer require syntech/syntechtable

用法

创建新表格

要创建新表格,使用 Artisan 命令

php artisan syntechtable:make Dashboard/StudentTable

此命令将在 App\SyntechTable\Dashboard\StudentTable 中创建一个新的表格类。

渲染表格

要在视图中渲染表格,请在 Blade 模板中包含以下 HTML 和 Blade 语法

<div id="myGrid" class="ag-theme-quartz" style="height: auto"></div>

{!! $scripts !!}

此代码设置了一个用于 AG Grid 表格的容器,并包含了初始化和配置网格所需的 JavaScript。

自定义表格样式

您可以通过添加以下 CSS 到您的 Blade 模板或应用程序的 CSS 文件来自定义 AG Grid 表格的样式

<style>
    .ag-theme-quartz {
        /* Changes the color of the grid text */
        --ag-font-color: rgb(51, 51, 51);
        
        /* Changes the color of the grid background */
        --ag-background-color: rgb(241, 247, 255);
        
        /* Changes the header color of the top row */
        --ag-header-background-color: rgb(228, 237, 250);
        
        /* Changes the hover color of the row */
        --ag-row-hover-color: rgb(216, 226, 255);
    }
</style>

此 CSS 片段调整了 AG Grid 主题中的各种颜色,以匹配您的设计偏好。

配置

您可以通过配置文件配置 SyntechTable 包的各个方面。使用以下命令发布配置文件

php artisan vendor:publish --provider="Syntech\SyntechTable\Providers\SyntechTableServiceProvider"