📘
Slickgrid-React
Live DemoGitHub
  • Introduction
  • Getting Started
    • Quick start
  • Styling
    • Dark Mode
    • Styling CSS/SASS/Themes
  • Column Functionalities
    • Cell Menu (Action Menu)
    • Editors
      • Autocomplete
      • new Date Picker (vanilla-calendar)
      • LongText (textarea)
      • Select Dropdown Editor (single/multiple)
    • Filters
      • Autocomplete
      • Input Filter (default)
      • Select Filter (dropdown)
      • Compound Filters
      • Range Filters
      • Custom Filter
      • Styling Filled Filters
      • Single Search Filter
    • Formatters
    • Sorting
  • Events
    • Available events
    • On Events
  • Slick Grid/DataView Objects
    • Slick Grid/DataView Objects
  • Grid Functionalities
    • Auto-Resize / Resizer Service
    • Resize by Cell Content
    • Column Picker
    • Composite Editor Modal
    • Custom Tooltip
    • Add, Update or Highlight a Datagrid Item
    • Dynamically Add CSS Classes to Item Rows
    • Column & Row Spanning
    • Context Menu
    • Custom Footer
    • Excel Copy Buffer Plugin
    • Export to Excel
    • Export to File (csv/txt)
    • Grid Menu
    • Grid State & Presets
    • Grouping & Aggregators
    • Header & Footer Slots
    • Header Menu & Header Buttons
    • Infinite Scroll
    • Pinning (frozen) of Columns/Rows
    • Providing data to the grid
    • Row Detail
    • Row Selection
    • Tree Data Grid
    • Row Based Editing Plugin
  • Developer Guides
    • CSP Compliance
  • Localization
    • with I18N
    • with Custom Locales
  • Backend Services
    • Custom Backend Service
    • OData
    • GraphQL
      • JSON Result Structure
      • Filtering Schema
      • Pagination Schema
      • Sorting Schema
  • Testing
    • Testing Patterns
  • Migrations
    • Migration Guide to 3.x (2023-05-29)
    • Migration Guide to 4.x (2023-12-15)
    • Migration Guide to 5.x (2024-05-10)
    • Versions 6 to 8 are skipped...
    • Migration Guide to 9.x (2025-05-10)
Powered by GitBook
On this page
  • The action column
  • Support for the Excel Copy Buffer Plugin
  • How the plugin works
Edit on GitHub
  1. Grid Functionalities

Row Based Editing Plugin

PreviousTree Data GridNextCSP Compliance

Last updated 3 days ago

index

  • Troubleshooting

Description

The Row based editing plugin makes it possible to keep the grid readonly except for rows which the user explicitely toggles into edit mode.

Note: This plugin enforces the use of the autoEdit option and will turn it on with a console warning if its not already.

Demo

/

The action column

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.

Single or multiple editable rows

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.

Configuring the action buttons

Support for the Excel Copy Buffer Plugin

How the plugin works

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. 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.

Here's the respective code shown in Example22:

ViewModel

onBeforeRowUpdated(args) {
  const { effortDriven, percentComplete, finish, start, duration, title } = args.dataContext;

  if (duration > 40) {
    alert('Sorry, 40 is the maximum allowed duration.');
    return Promise.resolve(false);
  }

  return fakeFetch('your-backend-api/endpoint', {
    method: 'POST',
    body: JSON.stringify({ effortDriven, percentComplete, finish, start, duration, title }),
    headers: {
      'Content-type': 'application/json; charset=UTF-8'
    }
  }).catch(err => {
    console.error(err);
    return false;
  })
  .then(response => {
    if (response === false) {  // <---- the negative response, e.g validation failed, keep the row as is
      return false;
    }
    if (typeof response === 'object') {
      return response!.json();
    }
  })
  .then(json => {
    alert(json.message);
    return true;  // <--- all good, apply changes in grid and toggle row into readonly mode
  });
},

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 .

If the 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.

plugins options
Excel Copy Buffer Plugin
Demo
Demo Component
The action column
Multiple Row Selections
Change Dynamically Single/Multiple Selections
Mixing Single & Multiple Row Selections
Disable Custom Rows Selections via selectableOverride
Disable External Button when having Empty Selection
Change Row Selections
Adding a Column dynamically is removing the Row Selection, why is that?