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
To learn more about using DataGrid outside of svelte, read [svelte's guide](https://svelte.dev/docs#Client-side_component_API) on how to interact with a svelte component. It is possible to integrate into any framework.
76
78
77
79
DataGrid requires 2 properties to be passed in order to display data: `rows` and `columns`.
78
80
79
81
`columns` is an array of objects containing at least 3 properties: `display`, `dataName`, and `width`. A svelte component can be specified in `headerComponent` and `cellComponent` if any custom cell behavior is required.
80
82
81
-
```
83
+
```js
82
84
[
83
85
{
84
86
display:'Fruit Name', // What will be displayed as the column header
@@ -98,7 +100,7 @@ DataGrid requires 2 properties to be passed in order to display data: `rows` and
98
100
99
101
`rows` is an array of objects containing the data for each table row.
100
102
101
-
```
103
+
```js
102
104
[
103
105
{
104
106
fruitName:'Apple',
@@ -121,15 +123,15 @@ DataGrid requires 2 properties to be passed in order to display data: `rows` and
121
123
Version 2 added early support for editing data. Due to the lack of using a keyed each block to render the rows, maintaining focus on controls as the user scrolls is a tad wonky. This will be resolved in a future version.
Textbox cell will debounce the user input, only recording changes after 400ms has elapsed since the user stops typing.
132
-
```
134
+
```js
133
135
{
134
136
display:'Name',
135
137
dataName:'name',
@@ -141,7 +143,7 @@ Textbox cell will debounce the user input, only recording changes after 400ms ha
141
143
### Select Cell
142
144
143
145
SelectCell requires that you provide an `options` array in your cell definition:
144
-
```
146
+
```js
145
147
{
146
148
display:'Eye Color',
147
149
dataName:'eyeColor',
@@ -166,7 +168,7 @@ SelectCell requires that you provide an `options` array in your cell definition:
166
168
167
169
### Checkbox Cell
168
170
CheckboxCell will set the checked state of the checkbox depending on the boolean value of the row's data.
169
-
```
171
+
```js
170
172
{
171
173
display:'Active',
172
174
dataName:'isActive',
@@ -187,7 +189,7 @@ Components will be passed the following properties:
187
189
188
190
189
191
MyCustomCell.svelte
190
-
```
192
+
```js
191
193
<script>
192
194
exportlet data = {
193
195
colors: {
@@ -203,12 +205,12 @@ export let data = {
203
205
```
204
206
205
207
Import the component
206
-
```
208
+
```js
207
209
importMyCustomCellfrom'./MyCustomCell.svelte';
208
210
```
209
211
210
212
`columns` option:
211
-
```
213
+
```js
212
214
[
213
215
{
214
216
display:'Fruit Color'
@@ -222,6 +224,10 @@ import MyCustomCell from './MyCustomCell.svelte';
222
224
## Custom Header Components
223
225
Header components can also be specified in `columns` entries as the `headerComponent` property. Header components are only passed `column`, the column object from `columns`.
0 commit comments