@@ -74,6 +74,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
74
74
``` json
75
75
{
76
76
"autoWidth" : true ,
77
+ "classNames" : undefined,
77
78
"cols" : [" " ],
78
79
"from" : undefined,
79
80
"language" : undefined,
@@ -82,6 +83,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
82
83
"search" : false ,
83
84
"server" : undefined,
84
85
"sort" : false ,
86
+ "styles" : undefined,
85
87
"theme" : " mermaid" ,
86
88
"width" : " 100%"
87
89
}
@@ -93,6 +95,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
93
95
<template >
94
96
<grid
95
97
:auto-width =" autoWidth"
98
+ :class-names =" classNames"
96
99
:cols =" cols"
97
100
:from =" from"
98
101
:language =" language"
@@ -101,6 +104,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
101
104
:search =" search"
102
105
:server =" server"
103
106
:sort =" sort"
107
+ :styles =" styles"
104
108
:width =" width"
105
109
></grid >
106
110
</template >
@@ -117,19 +121,43 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
117
121
return {
118
122
// REQUIRED:
119
123
120
- // An array containing strings of column headers
124
+ // An array containing strings of column headers (`columns` in the Grid.js API)
121
125
cols: [' col 1' , ' col 2' ],
122
126
123
- // AND EITHER an array containing row data
127
+ // AND EITHER an array containing row data (`data` in the Grid.js API)
124
128
rows: [
125
129
[' row 1 col 1' , ' row 1 col 2' ],
126
130
[' row 2 col 1' , ' row 2 col 2' ]
127
131
],
128
132
129
- // OR a string of an HTML table selector to import
130
- from: ' .my-element'
133
+ // OR an array containing JSON row data
134
+ rows: [
135
+ { ' col 1' : ' row 1' , ' col 2' : ' row 1' },
136
+ { ' col 1' : ' row 2' , ' col 2' : ' row 2' }
137
+ ]
138
+
139
+ // OR a function returning an array of row data
140
+ rows () {
141
+ return [
142
+ { ' col 1' : 3 + 4 , ' col 2' : 5 + 6 },
143
+ { ' col 1' : 1 * 2 , ' col 2' : 7 * 8 }
144
+ ]
145
+ }
131
146
132
- // OR a server settings object
147
+ // OR a string of an HTML table selector to import
148
+ from: ' .my-element' ,
149
+
150
+ // OR a function returning an HTML table string
151
+ from () {
152
+ return `
153
+ <table>
154
+ <tr><th>column 1</th></tr>
155
+ <tr><td>${ 1 * 2 } </td></tr>
156
+ </table>
157
+ `
158
+ }
159
+
160
+ // OR a server settings function or object
133
161
server () ({
134
162
url: ' https://api.com/search?q=my%20query' ,
135
163
then : res => res .data .map (col => [col1 .data , col2 .data ]),
@@ -143,18 +171,24 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
143
171
// Boolean to automatically set table width
144
172
autoWidth: true / false ,
145
173
174
+ // Object with CSS class names (`className` in the Grid.js API)
175
+ classNames: {},
176
+
146
177
// Localization dictionary object
147
178
language: {},
148
179
149
180
// Boolean or pagination settings object
150
181
pagination: true / false || {},
151
182
152
- // Boolean or search settings object
153
- search: true / false || {} ,
183
+ // Boolean
184
+ search: true / false ,
154
185
155
186
// Boolean or sort settings object
156
187
sort: true / false || {},
157
188
189
+ // Object with CSS styles (`style` in the Grid.js API)
190
+ styles: {},
191
+
158
192
// String with name of theme or 'none' to disable
159
193
theme: ' mermaid' ,
160
194
0 commit comments