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
Copy file name to clipboardExpand all lines: README.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ const data = [{
99
99
100
100
constcolumns= [{
101
101
header:'Name',
102
-
accessor:'name'// String-based value accessors !
102
+
accessor:'name'// String-based value accessors!
103
103
}, {
104
104
header:'Age',
105
105
accessor:'age',
@@ -245,7 +245,7 @@ Or just define them as props
245
245
```javascript
246
246
[{
247
247
// General
248
-
accessor:'propertyName' or Accessor eg. (row) =>row.propertyName,
248
+
accessor:'propertyName'//or Accessor eg. (row) => row.propertyName (see "Accessors" section for more details)
249
249
id:'myProperty', // Conditional - A unique ID is required if the accessor is not a string or if you would like to override the column name used in server-side calls
250
250
sortable:true,
251
251
show:true, // can be used to hide a column
@@ -278,6 +278,28 @@ Or just define them as props
278
278
}]
279
279
```
280
280
281
+
## Accessors
282
+
Accessors are functions that return the value to populate the row's value for the column.
283
+
This lets the render function not have to worry about accessing the correct data, the value is automatically populated in it's props.
284
+
285
+
If a `string` or `array` is passed the default accessor is used.
286
+
The default accessor will parse the input into an array and recursively flatten it.
287
+
Any values that contain a dot (`.`) will be split.
288
+
Any values that contain bracket (`[]`) will be split.
289
+
This array is then used as the path to the value to return.
290
+
291
+
("$" is the placeholder value that would be returned by the default accessor)
If your data has a field/key with a dot (`.`) you will need to supply a custom accessor.
301
+
302
+
281
303
## Column Header Groups
282
304
To group columns with another header column, just nest your columns in a header column. Header columns utilize the same header properties as regular columns.
0 commit comments