DEV Community

方帅
方帅

Posted on

1

How to edit a table's cell with VTable?

Title

Can an editable table enter the editing state directly when clicked, instead of double clicking a cell to make it editable?

Description

In the table editing scenario, double-clicking to enter the editing state would be cumbersome, and you need to enter the editing state directly.

Solution

You can configure editCellTrigger to click in the table initialization option. The configuration item is defined as follows:

/** Edit triggering time: double click event | single click event | api to manually start editing. Default is double click 'doubleclick' */
editCellTrigger?: 'doubleclick' | 'click' | 'api';
Enter fullscreen mode Exit fullscreen mode

Code Example

  const option = {
    records,
    columns,
    autoWrapText: true,
    limitMaxAutoWidth: 600,
    heightMode: 'autoHeight',
    editCellTrigger: 'click' // Set the edit trigger timing
  };
  const tableInstance = new VTable.ListTable(container, option);
Enter fullscreen mode Exit fullscreen mode

Results

Online effect reference: https://visactor.io/vtable/demo/edit/edit-cell

Image description

Related Documents

Edit table demo: https://visactor.io/vtable/demo/edit/edit-cell
Edit table tutorial: https://visactor.io/vtable/guide/edit/edit_cell
Related API: https://visactor.io/vtable/option/ListTable#editCellTrigger
github: https://github.com/VisActor/VTable

API Trace View

How I Cut 22.3 Seconds Off an API Call with Sentry 🕒

Struggling with slow API calls? Dan Mindru walks through how he used Sentry's new Trace View feature to shave off 22.3 seconds from an API call.

Get a practical walkthrough of how to identify bottlenecks, split tasks into multiple parallel tasks, identify slow AI model calls, and more.

Read more →

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay