Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: remove spinner + reduce load time + add rowDataMapper - PTL-1517 #2042

Merged
merged 7 commits into from
Dec 6, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very useful, thanks. However to be very nitpicky, in every other doc we've created a seperate table for properties just so it's super clear to use the :

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in a71d87d

Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,21 @@ Some **resource** attributes are `DATASERVER` or `REQUEST_SERVER` specific, whil
<grid-pro-server-side-datasource view-number="2">
```

</td>
</tr>
<tr>
<td><code>:rowDataMapper</code></td>
<td><code>Function</code></td>
<td>Function to map the row data before it is sent to the grid. The function should return an array of objects, where each object represents a row in the grid.</td>
<td>

```html
matteematt marked this conversation as resolved.
Show resolved Hide resolved
<grid-pro-client-side-datasource
:rowDataMapper="${(data) => data.map((row) => ({ ...row, calculatedValue: row.value1 + row.value2 }))}">
<grid-pro-server-side-datasource
:rowDataMapper="${(data) => data.map((row) => ({ ...row, calculatedValue: row.value1 + row.value2 }))}">
```

</td>
</tr>
</tbody>
Expand Down Expand Up @@ -334,14 +349,15 @@ Some **resource** attributes are `DATASERVER` or `REQUEST_SERVER` specific, whil
</td>
</tr>
<tr>
<td><code>request</code></td>
<td><code>string</code></td>
<td><code>:request</code></td>
<td><code>any</code></td>
<td>Similar to <code>fields</code> but for <a href="/develop/server-capabilities/snapshot-queries-request-server/">Request Server</a> scenarios. This optional parameter enables you to specify request fields, which can include wildcards.</td>
<td>

```html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now we're adding template strings I think typescript syntax works better

Suggested change
```html
```typescript

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

doesn't look good, let's stick with html (I also tried tsx which has the same output BUT in-editor it's all red/mixed with correct.. mdx + tables + code = doesn't work 100% in vscode)

<grid-pro-client-side-datasource request="Trade.*">
<grid-pro-server-side-datasource request="Position.*,Price.*">
<grid-pro-client-side-datasource :request="Trade.*">
<grid-pro-server-side-datasource :request="Position.*,Price.*">
<grid-pro-client-side-datasource :request="${() => ({ TRADE_ID: '00001' })}">
```

</td>
Expand All @@ -354,7 +370,7 @@ Some **resource** attributes are `DATASERVER` or `REQUEST_SERVER` specific, whil

```html
<grid-pro-client-side-datasource request-auto-setup>
<grid-pro-server-side-datasource request-auto-setup="true">
<grid-pro-server-side-datasource request-auto-setup=>
```

</td>
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you certain that this speed is ok? I set it to 2000 because I was testing on 1000 and sometimes it didn't load correctly?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it never failed for me.. @matteematt can you re-check this branch? let me know if it fails

Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,13 @@ function GridProExampleBase({
};

useEffect(() => {
const timer = setTimeout(() => { loadGridOptions(); }, 2000);
const timer = setTimeout(() => { loadGridOptions(); }, 500);
return () => clearTimeout(timer);
}, []);

return (
<CodeSection>
<div style={{ flex: 1, display: 'flex', flexDirection: 'column', height: gridHeight }}>
{!isLoaded ? (<LoadingRing />) : null}
<rapid-grid-pro ref={grid} ></rapid-grid-pro>
</div>
</CodeSection>
Expand Down Expand Up @@ -238,6 +237,7 @@ export function GridProExampleNumberEditor() {
disabled: false,
},
editable: true,
pinned: 'right',
}
: colDef
),
Expand Down