承接 ilbronza/datatables 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

ilbronza/datatables

Composer 安装命令:

composer require ilbronza/datatables

包简介

:package_description

README 文档

README

[![Latest Version on Packagist][ico-version]][link-packagist] [![Total Downloads][ico-downloads]][link-downloads] [![Build Status][ico-travis]][link-travis] [![StyleCI][ico-styleci]][link-styleci]

This is where your description should go. Take a look at contributing.md to see a to do list.

Installation

Via Composer

$ composer require ilbronza/datatables

add this lines to package.json dependencies list

"datatables.net-autofill-dt": "^2.3.6",
"datatables.net-buttons-dt": "^1.7.0",
"datatables.net-colreorder-dt": "^1.5.3",
"datatables.net-dt": "^1.10.24",
"datatables.net-fixedcolumns-dt": "^3.3.2",
"datatables.net-fixedheader-dt": "^3.1.8",
"datatables.net-keytable-dt": "^2.6.1",
"datatables.net-responsive-dt": "^2.2.7",
"datatables.net-rowgroup-dt": "^1.1.2",
"datatables.net-rowreorder-dt": "^1.2.7",
"datatables.net-scroller-dt": "^2.0.3",
"datatables.net-searchbuilder-dt": "^1.0.1",
"datatables.net-searchpanes-dt": "^1.2.2",
"datatables.net-select-dt": "^1.3.3",
"jszip": "^3.6.0",
"moment": "^2.29.1",
"webpack-jquery-ui": "^2.0.1"

run npm install from terminal

npm install

copy the file vendor/ilbronza/datatables/resources/js/ilBronza.datatables.js to resources/js/ilBronza.datatables.js add these line to resources/js/app.js to include the required modules. All other js files are included directly from vendor folder

require('./ilBronza.datatables.js');

keep in mind that it needs jQuery and jquery-ui, if you didn't required yet add to yout resources/js/app.js file

import $ from 'jquery';
window.$ = window.jQuery = $;

require('webpack-jquery-ui');

publish the package assets

php artisan vendor:publish --force --tag "datatables.assets"

compile the file with laravel-mix

npm run development

Usage

Form in table header and submit cell

You can populate a form in the header of the table and use a table cell as the submit button.
This feature is useful for quick inline filters or actions. To enable it, use the DatatableFieldSubmit field type in your configuration.

create a submit field

class DatatableFieldAddUnitloads extends DatatableFieldSubmit
{
    public $function = 'getAddUnitloadsToDeliveryUrl';
}

add the field to the table header

public function addPostFieldsToTable()
{
	$unitloads = Unitload::gpc()::whereIn('id', request()->unitloads)->get();

	foreach($unitloads as $unitload)
		$this->getTable()->addPostField(
			FormField::createFromArray([
				'label' => $unitload->getName() . ' (' . $unitload->getQuantity() . ')',
				'type' => 'text',
				'disabled' => true,
				'name' => 'unitloads[]',
				'value' => $unitload->getKey(),
			])
		);
}

use the created field in fields configuration

static function getFieldsGroup() : array
{
    return 
    [
        'fields' => 
        [
            'mySelfAddToDelivery' => 'warehouse::deliveries.addUnitloads'
        ]
    ];
}

Add data to headerData

Example for add data to th

'name' => [
    'type' => 'flat',
    'headerData' => [
        'reloadTable' => true,
        'merryChristmas' => 'something'
    ]
]

Example for fetcher field

    'mySelfTimingMessage.quantityWorkstations' => [
        'type' => 'iterators.each',
        'childParameters' => [
            'requiresPlaceholderElement' => true,
            'textParameter' => 'workstation_alias',
            'type' => 'links.fetcher',

            'fetcher' => [
                'urlMethod' => 'getPriceCalculationMessageUrl',
                //target is the place where to take the id from => 'currentField' || 'row'
                'target' => 'currentField',
                'target' => 'row'
            ]
        ],
        'width' => '25px'
    ],

Refresh dei campi form dopo draw / save riga

Le pagine edit possono registrare campi del form da rileggere dal server quando le tabelle cambiano (es. totali e margini ricalcolati). I campi si registrano come selettori in:

window.dtEditorRefreshingFieldList.push('input[name=total_cost]');

(es. il blade orderQuotationPage di Products li popola da getFieldsToUpdateOnTableEdit()).

Il refresh parte automaticamente in due momenti:

  1. Dopo il save di un campo editor in tabellawindow.dtRefreshFieldsList() viene chiamata nella success di __ibCallAjax.
  2. A ogni draw.dt (reload ajax, paginazione, sort, init, reloadAllTables) — con throttling trailing: la prima draw arma un timer, le draw successive nella finestra vengono assorbite, allo scadere parte un solo refresh.
// finestra di throttling del refresh su draw (default 1000ms)
window.__ibDtRefreshFieldsListOnDrawThrottleMs = 1000;

Se la lista dtEditorRefreshingFieldList è vuota il listener è un no-op: le pagine senza campi registrati non fanno alcuna chiamata.

dtRefreshFieldsList() delega a dtRefreshFieldsListBatch() (pacchetto FormField): i selettori vengono risolti in nomi campo e richiesti al server con una sola POST cumulativa (ib-editor-read-batch), invece di una chiamata per campo. Vedi il readme di ilbronza/formfield per l'API completa del batch.

DatatableFieldClasses

class DatatableFieldClient extends DatatableFieldSeeName
{
    public ? string $translationPrefix = 'clients::fields';
    public ? string $forcedStandardName = 'client';
}

ilbronza/datatables 适用场景与选型建议

ilbronza/datatables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 308 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「datatables」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 ilbronza/datatables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ilbronza/datatables 我们能提供哪些服务?
定制开发 / 二次开发

基于 ilbronza/datatables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: mit
  • 更新时间: 2021-03-16