Skip to content

Commit 6f6d150

Browse files
authored
Aggrid clarifications (windmill-labs#539)
1 parent a4fd55e commit 6f6d150

File tree

6 files changed

+47
-61
lines changed

6 files changed

+47
-61
lines changed

docs/apps/4_app_configuration_settings/database_studio.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import DocCard from '@site/src/components/DocCard';
22

33
# Database Studio
44

5-
This component allows you to create a database studio. The database studio is a web-based database management tool. It allows you to display and edit the content of a database. It uses Ag Grid to display the table.
5+
This component allows you to create a database studio. The database studio is a web-based database management tool. It allows you to display and edit the content of a database. It uses [Ag Grid](./aggrid_table.mdx) to display the table.
66

77
<iframe
88
style={{ aspectRatio: '16/9' }}
@@ -14,6 +14,10 @@ This component allows you to create a database studio. The database studio is a
1414
className="border-2 rounded-xl object-cover w-full dark:border-gray-800"
1515
></iframe>
1616

17+
<br/>
18+
19+
For simple data display, check out the [Table](./table.mdx) component or the [Ag Grid](./aggrid_table.mdx) component.
20+
1721
## Features
1822

1923
- Display the content of a table.
Loading
Loading

docs/misc/9_guides/aggrid_table/index.md

Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# AgGrid Table
1+
# AgGrid Table Guide
22

33
This is a basic introduction on how to use
44
[AgGrid Table](https://www.ag-grid.com/) together with Windmill. It assumes
55
little to no knowledge about AgGrid.
66

77
![AgGrid Overview](../../../../static/img/guide/aggrid_overview.png.webp)
88

9-
## What is AgGrid Table.
9+
## What is AgGrid Table
1010

11-
The AgGrid Table component (called AgGrid from here) is a small wrapper around a
11+
The [AgGrid Table component](../../../apps/4_app_configuration_settings/aggrid_table.mdx) (called AgGrid from here) is a small wrapper around a
1212
fantastic library called [AgGrid](https://www.ag-grid.com/). It provides you with
1313
a lot of advanced features. It comes in a free and a Enterprise (paid) version.
1414
All features below are part of the free version of AgGrid.
@@ -18,18 +18,17 @@ If you need the enterprise version of AgGrid, please
1818
[contact us](../../6_getting_help/index.mdx).
1919
:::
2020

21-
## AgGrid vs Table component
21+
## AgGrid vs Table component vs Database Studio
2222

23-
In Windmill there are 2 table components: one simply called
24-
[Table](../table/index.md)
25-
and AgGrid.
23+
In Windmill there are 3 table components: one simply called [Table](../../../apps/4_app_configuration_settings/table.mdx),
24+
[AgGrid](../aggrid_table/index.md) and [Database Studio](../../../apps/4_app_configuration_settings/database_studio.mdx).
2625

27-
The Table component is for most usecases. It takes an array of objects as d
26+
The [Table component](../../../apps/4_app_configuration_settings/table.mdx) is for most usecases. It takes an array of objects as d
2827
input, and uses the key of the object as the header of the table. It also
2928
provides you with one or more action buttons to trigger an action for the row or
3029
create a dropdown button based on the row data.
3130

32-
But if you want the user to be able to sort the table, edit a value inplace, adjust width and more you want to reach for AgGrid.
31+
[Database Studio](../../../apps/4_app_configuration_settings/database_studio.mdx) is a web-based database management tool. It allows you to display and edit the content of a database.
3332

3433
:::info Transformer
3534
If you want to do basic sorting, or edit the column header name from the script
@@ -72,7 +71,7 @@ for the complete list of properties.
7271
As with most things, Windmill lets you **dropdown to code** when you want to do
7372
more advanced stuff, where the gui is more in the way then helping.
7473

75-
The Windmill way wil be to first create a background runnable and then
74+
The Windmill way will be to first create a background runnable and then
7675
connecting it with the col def.
7776

7877
![Column definitions](./../../../../static/img/guide/coldef-connect.png.webp)
@@ -84,61 +83,36 @@ Below is a series of snippets that will help you get started.
8483

8584
#### Provide default values for all columns
8685

87-
Create a background runnable in Deno with the following content:
86+
Create a [background runnable](../../../apps/3_app-runnable-panel.mdx#background-runnables) that is a [Frontend JavaScript](../../../apps/3_app-runnable-panel.mdx#frontend-scripts) with the following content:
8887

8988
```js
90-
export async function main() {
91-
const columnDef = [
92-
{
93-
field: 'name',
94-
headerName: 'Full name'
95-
},
96-
{
97-
field: 'age',
98-
sortable: false
99-
}
100-
];
89+
const columnDef = [
90+
{
91+
field: 'name',
92+
headerName: 'Full name'
93+
},
94+
{
95+
field: 'age',
96+
sortable: false
97+
}
98+
];
10199

102-
const defaultColumnProperties = {
103-
sortable: true
104-
};
100+
const defaultColumnProperties = {
101+
sortable: true
102+
};
105103

106-
return columnDef.map((col) => ({ ...defaultColumnProperties, ...col }));
107-
}
104+
return columnDef.map((col) => ({ ...defaultColumnProperties, ...col }));
108105
```
109106

110-
#### Provide default values for all columns
111-
112-
Create a background runnable in deno with the following content:
113-
114-
```ts
115-
export async function main() {
116-
const columnDef = [
117-
{
118-
field: 'name',
119-
headerName: 'Full name'
120-
},
121-
{
122-
field: 'age',
123-
sortable: false
124-
}
125-
];
126-
127-
const defaultColumnProperties = {
128-
sortable: true
129-
};
130-
131-
return columnDef.map((col) => ({ ...defaultColumnProperties, ...col }));
132-
}
133-
```
107+
![Column Def Script](./column_def1.png )
134108

135109
#### Create a select button
136110

137111
Here we are using a AgGrid Component called `agSelectCellEditor`. There
138112
[exist more predefined cell components](https://www.ag-grid.com/javascript-data-grid/provided-cell-editors/#select-cell-editor)
139113
like this.
140114

141-
Create a frontend script in JS with the following content:
115+
Create a [Frontend JavaScript](../../../apps/3_app-runnable-panel.mdx#frontend-scripts) with the following content:
142116

143117
```js
144118
return [
@@ -158,7 +132,7 @@ return [
158132
];
159133
```
160134

161-
and connect it to the column definition.
135+
and [connect it](../../../apps/2_connecting_components/index.mdx) to the column definition.
162136

163137
If you want to act on changes in the select dropdown, you may use the components
164138
states `newChanges`, or `selectedRow`.
@@ -167,7 +141,7 @@ states `newChanges`, or `selectedRow`.
167141

168142
### Create a button (custom component)
169143

170-
Create a frontend script in JS with the following content:
144+
Create a [Frontend JavaScript](../../../apps/3_app-runnable-panel.mdx#frontend-scripts) with the following content:
171145

172146
```js
173147
class BtnCellRenderer {
@@ -205,7 +179,7 @@ return [
205179
];
206180
```
207181

208-
and connect it to the column definition.
182+
and [connect it](../../../apps/2_connecting_components/index.mdx) to the column definition.
209183

210184
This example demonstrates how to create a custom cell renderer component. Where
211185
we put the data from the row into our state. from here we can use other scripts

docs/misc/9_guides/table/index.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,20 @@ This is a introduction on how to use the Table component in Windmill.
44

55
![Table API](../../../assets/apps/4_app_component_library/table.png.webp)
66

7-
## AgGrid vs Table component
7+
## AgGrid vs Table component vs Database Studio
88

9-
In Windmill there are 2 table components: one simply called Table and
10-
[AgGrid](../aggrid_table/index.md).
9+
In Windmill there are 3 table components: one simply called Table,
10+
[AgGrid](../aggrid_table/index.md) and [Database Studio](../../../apps/4_app_configuration_settings/database_studio.mdx).
1111

1212
The Table component is for most usecases. In it's simplest form it takes an
1313
array of objects as input, and uses the key of the object as the header of the
1414
table.
1515

16-
See bottom of documents for the current Limitations.
16+
See bottom of this document for the current Limitations.
17+
18+
[AgGrid](../aggrid_table/index.md) component provides you with a lot of advanced features.
19+
20+
[Database Studio](../../../apps/4_app_configuration_settings/database_studio.mdx) is a web-based database management tool. It allows you to display and edit the content of a database.
1721

1822
### Examples
1923

sidebars.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ const sidebars = {
9393
id: 'misc/guides/app_send_email_smtp/index',
9494
label: 'App that Sends Email with SMTP'
9595
},
96-
'misc/guides/aggrid_table/index',
96+
{
97+
type: 'doc',
98+
id: 'misc/guides/aggrid_table/index',
99+
label: 'AgGrid Table'
100+
},
97101
'misc/guides/table/index',
98102
'misc/guides/sequin/index'
99103
]

0 commit comments

Comments
 (0)