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
{{ message }}
This repository was archived by the owner on Jun 1, 2025. It is now read-only.
A Cell Menu, most often used as an Action Menu and is more oriented on a row action (e.g. delete current row), it could be defined on 1 or more columns (defined in a column definition) and is triggered by a cell click or touch. The menu can show a list of Commands (to execute an action) and/or Options (to change the value of a field). Also note that the Commands list is following the same structure used in the [Context Menu](../grid-functionalities/Context-Menu.md), [Header Menu](../grid-functionalities/Header-Menu-&-Header-Buttons.md) & [Grid Menu](../grid-functionalities/Grid-Menu.md). The Cell Menu is very similar to the [Context Menu](../grid-functionalities/Context-Menu.md), both were create as SlickGrid plugins during the same period, their main difference is that they get triggered differently (cell click vs mouse right+click) and they serve different purposes. The Cell Menu is more oriented on a row action (e.g. delete current row) while the Context Menu is all about actions for the entire grid (e.g. export to Excel).
Using the [Row Based Editing Plugin](../grid-functionalities/Row-based-edit.md) you can let the user toggle either one or multiple rows into edit mode, keep track of cell changes and either discard or save them on an individual basis using a custom `onBeforeRowUpdated` hook.
All the available options that can be provided as `filterOptions` to your column definitions can be found under this [AutocompleterOption interface](/ghiscoding/angular-slickgrid/blob/master/src/app/modules/angular-slickgrid/models/autocompleterOption.interface.ts) and you should cast your `filterOptions` to that interface to make sure that you use only valid options of the jQueryUI autocomplete library.
71
+
All the available options that can be provided as `filterOptions` to your column definitions can be found under this [AutocompleterOption interface](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/autocompleterOption.interface.ts) and you should cast your `filterOptions` to that interface to make sure that you use only valid options of the jQueryUI autocomplete library.
The `Grid State` are what we defined as the currently used `Columns` / `Filters` / `Sorters` / `Pagination` of the actual grid (pagination is only returned when used with Backend Service API). The columns also include their (size, position order & visibility (show/hidden)).
19
19
#### Presets
20
-
Presets can be used to preset a grid with certain `Columns` / `Filters` / `Sorters` / `Pagination`. When we say `Columns`, we actually mean their size, order position and visibility (shown/hidden) in the grid.
20
+
Presets can be used to preset a grid with certain `Columns` / `Filters` / `Sorters` / `Pagination`. When we say `Columns`, we actually mean their size, order position and visibility (shown/hidden) in the grid.
21
21
#### Combining the two together
22
22
So basically, the idea is to save the `Grid State` in Local Storage (or DB) before the grid gets destroyed and once we come back to that same page we can preset the grid with the exact same state as it was before leaving the page (just like if we were doing a forward/back button with browser history).
23
23
@@ -26,10 +26,10 @@ You can get the `Grid State` at any point in time. However if you wish to save t
## HowtoLoadGridwithcertainColumns Preset (examplehidecertainColumn(s) on load)
202
-
Youcanshow/hideorevenchangecolumnpositionallviathe`presets`, yes`presets`isthatpowerful. AllyouneedistopassallColumnsthatyouwanttoshowaspartofthe`columns`propertyof`presets`. Typicallyyoualreadyhavetheentirecolumnsdefinitionsinceyoujustdefinedit, soyoucanre-usethatandjustuse`map`toloopthroughandpopulatethe`columns`accordingtothestructure needed (see [presetstructure](#structure)). What you have to know is that whatever array you pass will drive what the user will see and at which order the columns will show (basicallythearrayorderdoesmatter). If a Columns is omitted from that array, thenitwillbecomeahidden column (youcanstillshowitthroughGridMenuorColumnPicker).
202
+
Youcanshow/hideorevenchangecolumnpositionallviathe`presets`, yes`presets`isthatpowerful. AllyouneedistopassallColumnsthatyouwanttoshowaspartofthe`columns`propertyof`presets`. Typicallyyoualreadyhavetheentirecolumnsdefinitionsinceyoujustdefinedit, soyoucanre-usethatandjustuse`map`toloopthroughandpopulatethe`columns`accordingtothestructure needed (see [presetstructure](#structure)). What you have to know is that whatever array you pass will drive what the user will see and at which order the columns will show (basicallythearrayorderdoesmatter). If a Columns is omitted from that array, thenitwillbecomeahidden column (youcanstillshowitthroughGridMenuorColumnPicker).
203
203
204
204
SoletsaythatwewanttohidethelastColumnonpage load, wecanjustfindthecolumnbyit's `id` that you want to hide and pass the new column definition to the `presets` (again make sure to follow the correct preset structure).
205
205
@@ -213,8 +213,8 @@ this.columnDefinitions = [
213
213
// and use `map()` to only pull required field for presets to work
As pointed out earlier, the `presets` requires a specific structure where the `columns` is the list of columns to show/hide with their possible widths and also the position in the array is very important as it defines the position shown in the UI
The default of Slickgrid-Universal is to fit all columns in the container viewport and for the most part that is a good resize to use and it's fast. However if your grid has a lot of columns then doing a fit to viewport is not exactly great, you have lot of columns a few of these columns will become too small (we strongly suggest adding `minWidth` to every column) and you'll start seeing ellipsis to a few of these columns.
A new column is rendered that shows an edit/delete button. If the user clicks on edit, a save and cancel button are shown instead and the row toggles into edit mode. By default as the last column but you can override it with the option `columnIndexPosition`. Additionally it's default column id can be overriden using the opiton `columnId`. Furthermore, you can also override the columns label via the `actionsColumnLabel` property.
22
+
23
+
### Single or multiple editable rows
24
+
By default you can only toggle a single row into edit mode. If you set the option `allowMultipleRows` to `true` on the other hand, you can toggle as many as you want.
25
+
26
+
### Configuring the action buttons
27
+
You can override the styling, the hover text as well as whether a prompt — and with what text — should be shown. It is done by overriding the `actionButtons` property of the [plugins options](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/interfaces/rowBasedEditOption.interface.ts).
28
+
29
+
## Support for the Excel Copy Buffer Plugin
30
+
If the [Excel Copy Buffer Plugin](excel-copy-buffer.md) is configured, the Row based editing pluging will override it's behavior by denying pastes on all cells not within a edit mode row. Nevertheless, any existing `BeforePasteCellHandler` will be respected.
31
+
32
+
## How the plugin works
33
+
The idea of the plugin is to focus the users editing experience on specific individual rows and and save them individually. This is achieved by letting the user toggle one or more rows into edit mode.
34
+
When a that happens a potentially registered `onBeforeEditMode` callback is executed to handle various preparation or cleanup tasks. Now changes can be made to those rows and will be highlighted and tracked. The user may cancel the edit mode at any time and revert all cells changes. If the save button is pressed on the other hand an `onBeforeRowUpdated` hook, which you define via plugin options, is called and expects a `Promise<boolean>`. In that method you'd typically write the changes to your backend and return either true or false based on the operations outcome. If a negative boolean is returned the edit mode is kept, otherwise the row applies the changes and toggles back into readonly mode. That means, no modifications can be done on the grid.
35
+
36
+
Here's the respective code shown in Example22:
37
+
38
+
#### ViewModel
39
+
```ts
40
+
onBeforeRowUpdated(args) {
41
+
const { effortDriven, percentComplete, finish, start, duration, title } =args.dataContext;
42
+
43
+
if (duration>40) {
44
+
alert('Sorry, 40 is the maximum allowed duration.');
45
+
returnPromise.resolve(false);
46
+
}
47
+
48
+
returnfakeFetch('your-backend-api/endpoint', {
49
+
method: 'POST',
50
+
body: JSON.stringify({ effortDriven, percentComplete, finish, start, duration, title }),
51
+
headers: {
52
+
'Content-type': 'application/json; charset=UTF-8'
53
+
}
54
+
}).catch(err=> {
55
+
console.error(err);
56
+
returnfalse;
57
+
})
58
+
.then(response=> {
59
+
if (response===false) { // <---- the negative response, e.g validation failed, keep the row as is
60
+
returnfalse;
61
+
}
62
+
if (typeofresponse==='object') {
63
+
returnresponse!.json();
64
+
}
65
+
})
66
+
.then(json=> {
67
+
alert(json.message);
68
+
returntrue; // <--- all good, apply changes in grid and toggle row into readonly mode
Copy file name to clipboardExpand all lines: docs/styling/styling.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Default compiled `css` (if you use the plain Bootstrap Theme CSS, you could simp
21
21
```
22
22
23
23
#### SASS (`.scss`)
24
-
You could also compile the SASS files with your own customization, for that simply take any of the [_variables.scss](/ghiscoding/angular-slickgrid/blob/master/src/app/modules/angular-slickgrid/styles/_variables.scss) (without the `!default` flag) variable file and make sure to import the Bootstrap Theme afterward. For example, you could modify your `style.scss` with the following changes:
24
+
You could also compile the SASS files with your own customization, for that simply take any of the [_variables.scss](https://github.com/ghiscoding/slickgrid-universal/blob/master/packages/common/src/styles/_variables.scss) (without the `!default` flag) variable file and make sure to import the Bootstrap Theme afterward. For example, you could modify your `style.scss` with the following changes:
25
25
26
26
```scss
27
27
/* for example, let's change the mouse hover color */
0 commit comments