survos/grid-bundle

整合DatatablesNet,使用twig和stimulus,twig_component需要^2.3

赞助包维护!
kbond

安装量: 1,856

依赖: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 0

公开问题: 0

语言:JavaScript

类型:symfony-bundle

1.5.139 2024-02-02 19:34 UTC

This package is auto-updated.

Last update: 2024-08-31 00:41:32 UTC


README

使用DataTable.net JavaScript库配合Symfony和Twig。

composer req survos/grid-bundle

想法

https://domohelp.domo.com/hc/en-us/articles/360043931814-Fun-Sample-DataSets https://www.mytechylife.com/2015/09/29/next-and-previous-row-with-jquery-datatables/ https://github.com/lerocha/chinook-database http://2016.padjo.org/tutorials/sqlite-data-starterpacks/#more-info-simplefolks-for-simple-sql导入数据集

仅开发...

composer config repositories.survos_grid_bundle '{"type": "vcs", "url": "git@github.com:survos/SurvosGridBundle.git"}'

symfony new grid-demo --webapp --version=next --php=8.2 && cd grid-demo
composer config extra.symfony.allow-contrib true
composer req symfony/asset-mapper symfony/stimulus-bundle:2.x-dev
composer req survos/grid-bundle survos/scraper-bundle

# make it prettier with bootstrap, but not necessary
bin/console importmap:require bootstrap
echo "import 'bootstrap/dist/css/bootstrap.min.css'" >> assets/app.js

bin/console make:controller grid -i
cat > templates/grid.html.twig <<END
{% extends 'base.html.twig' %}

{% block body %}
    {% set data = request_data('https://jsonplaceholder.typicode.com/users') %}
    <twig:grid :data="data" :columns="data[0]|keys">
        <twig:block name="id">
            {{ row.id }}
        </twig:block>
        <twig:block name="title">
            <i>{{ row.title }}</i>
        </twig:block>
    </twig:grid>
    </table>
{% endblock %}
END
symfony server:start -d
symfony open:local --path=/grid