@@ -74,6 +74,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
7474``` json
7575{
7676 "autoWidth" : true ,
77+ "classNames" : undefined,
7778 "cols" : [" " ],
7879 "from" : undefined,
7980 "language" : undefined,
@@ -82,6 +83,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
8283 "search" : false ,
8384 "server" : undefined,
8485 "sort" : false ,
86+ "styles" : undefined,
8587 "theme" : " mermaid" ,
8688 "width" : " 100%"
8789}
@@ -93,6 +95,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
9395<template >
9496 <grid
9597 :auto-width =" autoWidth"
98+ :class-names =" classNames"
9699 :cols =" cols"
97100 :from =" from"
98101 :language =" language"
@@ -101,6 +104,7 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
101104 :search =" search"
102105 :server =" server"
103106 :sort =" sort"
107+ :styles =" styles"
104108 :width =" width"
105109 ></grid >
106110</template >
@@ -117,19 +121,43 @@ Refer to [Grid.js documentation](https://gridjs.io/docs/config/) for specific co
117121 return {
118122 // REQUIRED:
119123
120- // An array containing strings of column headers
124+ // An array containing strings of column headers (`columns` in the Grid.js API)
121125 cols: [' col 1' , ' col 2' ],
122126
123- // AND EITHER an array containing row data
127+ // AND EITHER an array containing row data (`data` in the Grid.js API)
124128 rows: [
125129 [' row 1 col 1' , ' row 1 col 2' ],
126130 [' row 2 col 1' , ' row 2 col 2' ]
127131 ],
128132
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+ }
131146
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
133161 server () ({
134162 url: ' https://api.com/search?q=my%20query' ,
135163 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
143171 // Boolean to automatically set table width
144172 autoWidth: true / false ,
145173
174+ // Object with CSS class names (`className` in the Grid.js API)
175+ classNames: {},
176+
146177 // Localization dictionary object
147178 language: {},
148179
149180 // Boolean or pagination settings object
150181 pagination: true / false || {},
151182
152- // Boolean or search settings object
153- search: true / false || {} ,
183+ // Boolean
184+ search: true / false ,
154185
155186 // Boolean or sort settings object
156187 sort: true / false || {},
157188
189+ // Object with CSS styles (`style` in the Grid.js API)
190+ styles: {},
191+
158192 // String with name of theme or 'none' to disable
159193 theme: ' mermaid' ,
160194
0 commit comments