mbischof / yii2-datatables
Yii2 Extension for DataTables jQuery plug-in
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.4.0
- bower-asset/datatables: ~1.10.16
- yiisoft/yii2: ~2.0
This package is not auto-updated.
Last update: 2024-04-23 15:31:39 UTC
README
Yii2 Widget for DataTables plug-in for jQuery
Installation
The preferred way to install this extension is through composer.
Either run
composer require mbischof/yii2-datatables
or add
"mbischof/yii2-datatables": "~1.0"
to the require section of your composer.json
file.
Basic Usage
<?= \mbi\datatables\BootstrapDatatableWidget::begin([ 'tableOptions' => [ 'class' => 'table table-striped table-bordered', 'width' => '100%', 'cellspacing' => 0 ] ]) ?> <thead> <tr> <th>Id</th> <th>Firstname</th> <th>Lastname</th> <th></th> </tr> </thead> <tbody> <?php foreach ($persons as $person): ?> <tr> <td style="text-align: center"><?= $person->id; ?></td> <td><?= $person->firstname; ?></td> <td><?= $person->lastname; ?></td> <td style="text-align: center"><?= Html::a(FA::icon('trash'), ['person/delete', 'id' => $person->id], ['data-method' => 'post']); ?></td> </tr> <?php endforeach; ?> </tbody> <?= \mbi\datatables\BootstrapDatatableWidget::end(); ?>