@@ -66,10 +66,10 @@ And then.. use the component:
66
66
Of course, code above will render garbage. Here are the props it accepts to render some sensible data:
67
67
68
68
```
69
- Prop name => Description => Example
69
+ Prop name => Description => Example
70
70
71
- title => The title of the datatable => "Todos" // Name in top
72
- columns => Columns. => [ // Array of objects
71
+ title => The title of the datatable => "Todos" // Name in top
72
+ columns => Columns. => [ // Array of objects
73
73
{
74
74
label: 'Name', // Column name
75
75
field: 'name', // Field name from row
@@ -79,23 +79,24 @@ columns => Columns. => [
79
79
html: false, // Escapes output if false.
80
80
}
81
81
]
82
- rows => Rows. => [ // Array of objects
82
+ rows => Rows. => [ // Array of objects
83
83
{
84
84
name: "test", // Whatever.
85
85
...
86
86
}
87
87
]
88
- perPage => Number of rows per.. page => 10 (default) // Results per page
89
- onClick => Func. to execute on click => console.log // Function, row 1st param
90
- clickable => Rows are clickable. => true (default) // Row is passed in the event payload
91
- Will fire `row-click` event // See react to click on row (below)
92
- sortable => Cause column-click to sort => true (default) // Whether sortable
93
- searchable => Add fuzzy search functionality => true (default) // Whether searchable
94
- exactSearch => Disable fuzzy search => true (default) // Whether only exact matches are returned
95
- paginate => Add footer next/prev. btns => true (default) // Whether paginated
96
- exportable => Add button to export to Excel => true (default) // Whether exportable
97
- printable => Add printing functionality => true (default) // Whether printable
98
- customButtons => Custom buttons thingy => [ // Array of objects
88
+ perPage => Numbers of rows per page => [10, 20, 30, 40, 50] (default) // Results per page
89
+ defaultPerPage => Default rows per page => 10 (default) // Default results per page, otherwise it will be the first value of perPage
90
+ onClick => Func. to execute on click => console.log // Function, row 1st param
91
+ clickable => Rows are clickable. => true (default) // Row is passed in the event payload
92
+ Will fire `row-click` event // See react to click on row (below)
93
+ sortable => Cause column-click to sort => true (default) // Whether sortable
94
+ searchable => Add fuzzy search functionality => true (default) // Whether searchable
95
+ exactSearch => Disable fuzzy search => true (default) // Whether only exact matches are returned
96
+ paginate => Add footer next/prev. btns => true (default) // Whether paginated
97
+ exportable => Add button to export to Excel => true (default) // Whether exportable
98
+ printable => Add printing functionality => true (default) // Whether printable
99
+ customButtons => Custom buttons thingy => [ // Array of objects
99
100
{
100
101
hide: false, // Whether to hide the button
101
102
icon: 'search', // Materialize icon
@@ -128,3 +129,25 @@ var app = new Vue({
128
129
...
129
130
130
131
```
132
+
133
+ ### Rows per page
134
+
135
+ You can specify the options of rows per page with the ` perPage ` prop. The first value will be the default value and the array will be sorted, so you can put whatever number you want.
136
+
137
+ ``` html
138
+ <!-- The default value will be 100 -->
139
+ <datatable :perPage =" [100, 10, 25, 50, 500]" ></datatable >
140
+
141
+ ```
142
+
143
+ The options will be rendered as ` [10, 20, 50, 100, 500] `
144
+
145
+ ![ Rows per page] ( http://i.imgur.com/kPtppKz.png )
146
+
147
+ Otherwise, you can specify the default rows per page with the ` defaultPerPage ` prop.
148
+
149
+ ``` html
150
+ <!-- The default value will be 100 -->
151
+ <datatable :perPage =" [10, 25, 50, 100, 500]" :defaultPerPage =" 100" ></datatable >
152
+
153
+ ```
0 commit comments