|
11 | 11 | | HTML elements that will be generated. |
12 | 12 | | |
13 | 13 | */ |
14 | | - 'default_css' => [ |
15 | | - // Will be appended to the <table> element |
16 | | - 'datagrid_class' => 'table table-condensed table-hover table-striped', |
| 14 | + 'datagrid_defaults' => [ |
| 15 | + 'view' => 'datagrid-builder::datagrid', |
| 16 | + 'attr' => [ |
| 17 | + // HTML & CSS |
| 18 | + 'data-classes' => 'table table-striped table-bordered table-hover', |
17 | 19 |
|
18 | | - // Will be appended to all the <th> elements |
19 | | - 'column_class' => 'table-column', |
20 | | - ], |
| 20 | + // Data |
| 21 | + 'data-url' => null, |
| 22 | + 'data-method' => 'GET', |
| 23 | + 'data-cache' => true, // Cache Ajax requests. |
| 24 | + 'data-flat' => true, // requires the "Flat JSON" extension; flattens to a single-level array. |
| 25 | + 'data-data-field' => 'data', // Which JSON attribute contains the data array? |
| 26 | + 'data-id-field' => 'id', // Indicate which field is an identity field. |
21 | 27 |
|
22 | | - /* |
23 | | - |-------------------------------------------------------------------------- |
24 | | - | Available Views |
25 | | - |-------------------------------------------------------------------------- |
26 | | - | |
27 | | - | This array contains all the views that can be used to properly |
28 | | - | generate a datagrid. |
29 | | - | |
30 | | - */ |
31 | | - 'views' => [ |
32 | | - // For client-side processing |
33 | | - 'client_datagrid' => 'datagrid-builder::clientDatagrid', |
| 28 | + // Sorting |
| 29 | + 'data-sortable' => true, // False to disable sortable of all columns. |
| 30 | + |
| 31 | + // Pagination |
| 32 | + 'data-pagination' => true, |
| 33 | + 'data-side-pagination' => 'client', // 'client' or 'server' with Ajax |
| 34 | + 'data-page-size' => 10, |
| 35 | + 'data-page-list' => '[5, 10, 20, 50, All]', |
34 | 36 |
|
35 | | - // For server-side processing |
36 | | - 'server_datagrid' => 'datagrid-builder::serverDatagrid', |
| 37 | + // Search |
| 38 | + 'data-search' => true, |
| 39 | + 'data-search-time-out' => 250, // Wait for X ms after last input before firing the search. |
37 | 40 |
|
38 | | - // For the table headers |
39 | | - 'column' => 'datagrid-builder::column', |
| 41 | + // UI |
| 42 | + 'data-locale' => 'en-US', |
| 43 | + 'data-show-refresh' => true, |
| 44 | + 'data-show-toggle' => false, // Toggle for the card view |
| 45 | + 'data-show-columns' => true, // Menu to show/hide columns. |
| 46 | + 'data-show-footer' => false, // A summary footer, for totals and such. |
| 47 | + ], |
40 | 48 | ], |
41 | 49 |
|
42 | | - /* |
43 | | - |-------------------------------------------------------------------------- |
44 | | - | Default Datagrid View |
45 | | - |-------------------------------------------------------------------------- |
46 | | - | |
47 | | - | Set the default view that will be used when generating a datagrid. |
48 | | - | Use one of the keys from the 'views' array above. |
49 | | - | |
50 | | - */ |
51 | | - 'default_datagrid_view' => 'client_datagrid', |
| 50 | + 'column_defaults' => [ |
| 51 | + 'view' => 'datagrid-builder::column', |
| 52 | + 'attr' => [ |
| 53 | + 'data-sortable' => true, |
| 54 | + 'data-order' => 'asc', |
| 55 | + 'data-visible' => true, |
| 56 | + 'data-searchable' => true, |
| 57 | + 'data-class' => null, // The column class name. |
| 58 | + 'data-field' => null, // The column field name. |
| 59 | + 'data-title' => null, // The column header title text. |
| 60 | + ], |
| 61 | + ], |
52 | 62 |
|
53 | | - /** |
54 | | - * jQuery Bootgrid assets location |
55 | | - */ |
56 | 63 | /* |
57 | 64 | |-------------------------------------------------------------------------- |
58 | 65 | | Assets Location |
|
65 | 72 | | that you already included it. |
66 | 73 | | |
67 | 74 | */ |
68 | | - 'css_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.css', |
69 | | - 'js_url' => '//cdnjs.cloudflare.com/ajax/libs/jquery-bootgrid/1.3.1/jquery.bootgrid.min.js', |
| 75 | + 'css_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.css', |
| 76 | + 'js_url' => '//cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.9.1/bootstrap-table.min.js', |
70 | 77 |
|
71 | 78 | ]; |
0 commit comments