Skip to content

Commit b8d7ac1

Browse files
committed
docs updated
1 parent cf2a565 commit b8d7ac1

9 files changed

Lines changed: 105 additions & 9 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
* Sorting
1616
* Resizable column
1717
* Hide columns
18+
* Change columns order
1819
* Sticky table header
1920
* Sticky columns
21+
* Checkbox column for rows seletion
2022
* Theming
2123
* Internationalization
2224

docs/assets/sample-grid/api-utils.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ class ApiUtils {
153153
let grandTotal = rows.length;
154154
rows = rows.splice(startIndex, count);
155155

156+
rows = rows.map((d) => {
157+
delete d.isRowSelected;
158+
159+
return d;
160+
});
161+
156162
return {
157163
rows,
158164
grandTotal,

docs/assets/sample-grid/grid.js

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@ class GridComponent extends GridCoreComponent {
33
let defaultOptions = {
44
exportable: true,
55
showSerialNumberCol: true,
6+
showSelectableCol: true,
7+
selectedRowsActions: [
8+
{ label: 'Delete', value: 'delete' },
9+
{ label: 'Change Status', value: 'change_status' },
10+
],
11+
// selectedRowsActions: ['Delete', 'Change Status'],
612
};
713

14+
if (options.rows) {
15+
options.rowsFromServer = false;
16+
}
17+
818
super(Object.assign(defaultOptions, options));
919
}
1020

@@ -42,9 +52,8 @@ class SampleGrid extends GridComponent {
4252
uniqueKey: 'sampleGrid',
4353
apiUrl: 'api/sample-grid',
4454
columns: sampleGrid.columns,
45-
// rowsFromServer: false,
46-
// rows: getRows(210),
47-
heightOffset: '70px',
55+
// rows: ApiUtils.getRows(210),
56+
heightOffset: '110px',
4857
sortable: true,
4958
// perPageOptions: [25, 50, 100, 200],
5059
showFilters: true,
@@ -67,4 +76,26 @@ class SampleGrid extends GridComponent {
6776
rendererHiddenCol1Filter(colData, $container) {
6877
$container.innerHTML = 'Custom filter section for hidden column';
6978
}
79+
80+
getSerialNumberColDetails(params = {}) {
81+
let details = super.getSerialNumberColDetails(params);
82+
details.width = '30px';
83+
84+
return details;
85+
}
86+
87+
isRowSelectable(rowData) {
88+
// return true;
89+
let rowIndex = rowData.rowIndex;
90+
let result = rowIndex === 0 || rowIndex % 6 !== 0;
91+
92+
if (!result) {
93+
result = {
94+
result,
95+
message: 'No permission',
96+
};
97+
}
98+
99+
return result;
100+
}
70101
}

docs/assets/script.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,18 @@ function initPageGetStarted() {
6363

6464
function initPageDemo() {
6565
let sampleGrid = new SampleGrid();
66+
67+
document.addEventListener('change', onDocumentChange);
68+
}
69+
70+
function onDocumentChange(e) {
71+
let $ele = e.target;
72+
73+
if ($ele.closest('.demo-grid-theme-input')) {
74+
onDemoGridThemeChange(e);
75+
}
76+
}
77+
78+
function onDemoGridThemeChange(e) {
79+
GridCoreComponent.setTheme(e.target.value);
6680
}

docs/assets/styles.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ section.cover {
4646

4747
.markdown-section {
4848
max-width: 80%;
49+
padding-top: 15px;
4950
}
5051

5152
.docs-table-container td,
@@ -145,7 +146,32 @@ body[data-page='demo.md'] .github-corner {
145146
z-index: 0;
146147
}
147148

149+
body[data-page='demo.md'] .docsify-pagination-container {
150+
display: none;
151+
}
152+
148153
/* grid - start */
154+
.demo-grid-top *,
155+
.demo-grid-top *::before,
156+
.demo-grid-top *::after {
157+
box-sizing: border-box;
158+
}
159+
160+
.demo-grid-top {
161+
display: flex;
162+
align-items: center;
163+
height: 40px;
164+
margin-bottom: 15px;
165+
}
166+
167+
.demo-grid-theme-container {
168+
display: inline-flex;
169+
}
170+
171+
.demo-grid-theme-container .grid-comp-custom-input-container {
172+
margin-left: 10px;
173+
}
174+
149175
.grid-comp-filters-box-wrapper {
150176
z-index: 21;
151177
}

docs/demo.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<div class="demo-grid-top">
2+
<div class="demo-grid-theme-container">
3+
<b>Choose theme : </b>
4+
<label class="grid-comp-custom-input-container grid-comp-radio-container">
5+
<input type="radio" class="grid-comp-radio demo-grid-theme-input" value="light" name="demo-grid-theme-input" checked>
6+
<span class="grid-comp-custom-input-button"></span>
7+
<span class="grid-comp-custom-input-text">Light</span>
8+
</label>
9+
<label class="grid-comp-custom-input-container grid-comp-radio-container">
10+
<input type="radio" class="grid-comp-radio demo-grid-theme-input" value="dark" name="demo-grid-theme-input">
11+
<span class="grid-comp-custom-input-button"></span>
12+
<span class="grid-comp-custom-input-text">Dark</span>
13+
</label>
14+
</div>
15+
</div>
16+
117
<div id="sample-grid"></div>
218

319
<script>

docs/get-started.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ Every project has its own way of data handling and business logic. Considering t
1616
* Sorting
1717
* Resizable column
1818
* Hide columns
19+
* Change columns order
1920
* Sticky table header
2021
* Sticky columns
22+
* Checkbox column for rows seletion
2123
* Theming
2224
* Internationalization
2325

docs/properties.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
| showFilters | Boolean | false | Show filters button to open filters |
2020
| showSettings | Boolean | false | Show settings button to customize columns |
2121
| showSerialNumberCol | Boolean | false | Show serial number column |
22+
| showSelectableCol | Boolean | false | Show checkbox column to select rows ([more details](https://github.com/{{repo}}/discussions/1)) |
23+
| selectedRowsActions | Array\<String\> \| Array\<Object\> | | List of action buttons to show when rows selected.<br/>`['Delete', 'Change Status']`<br/>-- OR --<br/>`[`<br/>&nbsp;&nbsp;`{ label: 'Delete', value: 'delete' },`<br/>&nbsp;&nbsp;`{ label: 'Change Status', value: 'change_status' },`<br/> `]` |
2224
| theme | String | light | Default available themes are light and dark. But you could define custom themes and use here. ([more details](theming.md)) |
2325
| language | String | default | Language name to get i18n text ([more details](internationalization.md)) |
2426
| tooltipFontSize | String | 14px | Font size for tooltip |
@@ -40,12 +42,13 @@
4042

4143
| Name | Type | Default value | Description |
4244
| --- | --- | --- | --- |
43-
| id | String | | Unique column ID |
45+
| id | String | | Unique column ID (string without space or special characters) |
4446
| name | String | | Column header text |
4547
| key | String | | Property name to get column value from row details |
4648
| width | String | | Width of the column (in px) |
4749
| align | String | left | CSS text align value (left, right, center) |
4850
| renderer | Function | | Callback method name to render column value |
51+
| headRenderer | Function | | Callback method name to render column header |
4952
| sticky | Boolean | false | Make the column fixed on scroll horizontally |
5053
| resizable | Boolean | | Allow to resize width of the column |
5154
| sortable | Boolean | | Make the column sortable |

docs/theming.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,8 @@ class GridComponent extends GridCoreComponent {
3131
}
3232
```
3333

34-
Theme could be changed runtime by calling `setTheme` method
34+
Theme could be changed in runtime by calling `setTheme` method
3535

3636
```js
37-
/** to change for a specific grid */
38-
sampleGrid.setTheme('blue');
39-
40-
/** to change for all active grid instances */
4137
GridComponent.setTheme('blue');
4238
```

0 commit comments

Comments
 (0)