You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+91-84Lines changed: 91 additions & 84 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,40 @@
1
-
# HelloBootstrapTable
1
+
# HelloBootstrapTableBundle
2
2
3
3
**This Bundle provides *simple*[bootstrap-table](https://github.com/wenzhixin/bootstrap-table) configuration for your Doctrine Entities.**
4
4
5
5
Highly inspired by [SgDatatablesBundle](https://github.com/stwe/DatatablesBundle).
6
6
7
7
**The project is currently still under development. It can not be excluded that configuration changes.**
8
8
9
-
10
-
11
-
## When should I not use HelloBootstrapTable
12
-
13
-
HelloBootstrapTable is designed for simple tables that are strongly bound to the entities. If you are creating highly customized tables with many formatters and a lot of client-side programming, HelloBootstrapTable is not suitable for that. However, you can of course use HelloBootstrapTable alongside your complex tables.
| formatter | string | "defaultFormatter" | JavaScript function name for formatter. (see [formatter](https://bootstrap-table.com/docs/api/column-options/#formatter)) |
| displayName | string | "" | label of button in table|
393
+
| displayName | string | "" | label of button |
414
394
| routeName | string | "" | route name |
415
395
| routeParams | array | array("id") | Array of property value names for the route parameters. By default is `id` set. |
416
396
| classNames | string | "" | CSS class names which added directly to the `a` element. Overrides default class names from YAML config. |
417
397
| additionalClassNames | string | "" | You can set default class names in YAML config. Then you can add additional class names to the button without override the default config. |
418
398
399
+
#### YAML Example
400
+
401
+
```yaml
402
+
# config/packages/hello_table.yaml
403
+
404
+
hello_bootstrap_table:
405
+
action_button_options:
406
+
classNames: 'btn btn-xs'
407
+
```
408
+
409
+
YAML config options are set to all buttons. If you want override global options from YAML config use `classNames` option.
410
+
419
411
420
412
421
413
## Configuration
422
414
423
415
424
-
### Dataset Table Options
416
+
### Table Dataset Options
425
417
426
418
Table Dataset are provided directly to the `bootstrap-table` as data-attributes and are a collection of setting options for the table.
427
419
@@ -463,28 +455,27 @@ array(
463
455
464
456
#### Examples
465
457
466
-
Inside from Table class:
458
+
**Inside from Table class:**
467
459
468
460
``` php
469
461
// src/HelloTable/UserTable.php
470
462
471
463
class UserTable extends HelloBootstrapTable
472
464
{
473
465
...
474
-
475
-
protected function configureTableDataset(OptionsResolver $resolver)
466
+
467
+
protected function buildColumns(ColumnBuilder $builder, $options)
476
468
{
477
-
parent::configureTableProps($resolver);
478
-
479
-
$resolver->setDefaults(array(
469
+
$this->setTableDataset(array(
480
470
'locale' => 'de-DE'
481
471
));
472
+
473
+
// ... $builder->add()
482
474
}
483
475
}
484
476
```
485
477
486
-
487
-
Outside from Table class:
478
+
**Outside from Table class:**
488
479
489
480
``` php
490
481
// src/Controller/UserController.php
@@ -502,17 +493,27 @@ public function index(Request $request, HelloBootstrapTableFactory $tableFactory
502
493
}
503
494
```
504
495
496
+
**YAML config:**
497
+
498
+
YAML config options are set to all tables. If you want override global options from YAML config use `setTableDataset` method in or outside from `HelloBootstrapTable`.
499
+
500
+
```yaml
501
+
# config/packages/hello_table.yaml
502
+
503
+
hello_bootstrap_table:
504
+
table_dataset_options:
505
+
locale: 'de-DE'
506
+
# ... (see options from Table Dataset Options)
507
+
```
508
+
505
509
506
-
In the `configureTableDataset` method, you can specify custom data that can be provided directly to the `bootstrap-table`.
507
510
508
511
### Table Options
509
512
510
513
All options that should not be provided directly as data-attributes of the table are managed here.
511
514
512
515
#### Options
513
516
514
-
With the Persistence Options you can set which settings (filtering, sorting, current page, ...) should be stored in the cookies. By default, all of them are activated.
@@ -525,7 +526,7 @@ With the Persistence Options you can set which settings (filtering, sorting, cur
525
526
526
527
#### Examples
527
528
528
-
Inside from Table class:
529
+
**Inside from Table class:**
529
530
530
531
``` php
531
532
// src/HelloTable/UserTable.php
@@ -534,25 +535,18 @@ class UserTable extends HelloBootstrapTable
534
535
{
535
536
...
536
537
537
-
protected function configureTableOptions(OptionsResolver $resolver)
538
+
protected function buildColumns(ColumnBuilder $builder, $options)
538
539
{
539
-
parent::configureTableOptions($resolver);
540
-
541
-
$resolver->setDefaults(array(
542
-
'bulkUrl' => $this->router->generate('bulk'), //router are provided by HelloBootstrapTable
543
-
// actions are display as select field
544
-
// each option: value => display name
545
-
'bulkActions' => array(
546
-
'edit' => 'Edit',
547
-
'delete' => 'Delete'
548
-
)
540
+
$this->setTableOptions(array(
541
+
'enableCheckbox' => false
549
542
));
543
+
544
+
// ... $builder->add()
550
545
}
551
546
}
552
547
```
553
548
554
-
555
-
Outside from Table class:
549
+
**Outside from Table class:**
556
550
557
551
``` php
558
552
// src/Controller/UserController.php
@@ -569,6 +563,19 @@ public function index(Request $request, HelloBootstrapTableFactory $tableFactory
569
563
}
570
564
```
571
565
566
+
**YAML config:**
567
+
568
+
YAML config options are set to all tables. If you want override global options from YAML config use `setTableDataset` method in or outside from `HelloBootstrapTable`.
0 commit comments