revolist / revogrid

Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
https://rv-grid.com
MIT License
2.72k stars 171 forks source link

Click outside the grid, but cell still in edit mode and afteredit not fired #201

Closed Magenta94 closed 2 months ago

Magenta94 commented 3 years ago

Hi, I have set a background color to highlight the revo-grid html element. If I edit a cell and then I click outside the grid, but inside the revo-grid element, the cell still in edit mode. Only if i click outside the element it exit edit mode.

esempio

Example here: https://codesandbox.io/s/quiet-sound-136d9?file=/src/App.vue

Magenta94 commented 3 years ago

I also noticed that if I don't press enter key, as soon I click outside and the cell exit edit mode, the @afteredit event isn't fired and the cell has the old value. I expected that clicking outside, the cell gets the new value and fires the event, like Excel.

revolist commented 3 years ago

@Magenta94 first problem was fixed with v3.0.6

revolist commented 3 years ago

@Magenta94 could you be so kind and record a video or something where we can check your scenario and try to solve it?

Magenta94 commented 3 years ago

Sure, I'll try to explain better here. At the moment your component updates the value in the grid after you press enter key, and afteredit gets fired. In the example below I press 4, then enter key, the value is saved and in the console you see the afteredit triggered. But next I press 6 then I click with the mouse on another cell (without pressing enter key), the value is not saved, and afteredit is not fired. The grid still have number 4 saved.

1

I was expecting a behaviour like Excel, as you can see here I can insert a value in a cell, then click on another cell (without pressing enter key) and the value is saved.

2

van-huyen commented 3 years ago

+1 need Improvement.

When cell lost focus by "mouse click (right, mid, left)" event or "tab key" event, the value of the cell editing should be committed. (same Enter key event: commit cell data)

Thanks @revolist for amazing revogrid.

luis-f-lins commented 3 years ago

Do we have any updates on this? Any workarounds to save the cell's value when clicking outside of a cell? Tahnks.

Bruce0615 commented 2 years ago

@van-huyen

Can you please explain or show how did you make it for committing cell value by mouse click outside that cell?

Thanks in advance.

van-huyen commented 2 years ago

Hi @Bruce0615 , on @focusout event in v-grid, push a func to set cell value like that: image

set cell value: image

get row index and col name: image

maranyil commented 2 years ago

Hi! I'm on Vue 2, try the @van-huyen method, but can't make it work. Can anyone help me, please?

paramula commented 1 year ago

Hi @Bruce0615 , on @focusout event in v-grid, push a func to set cell value like that: image

set cell value: image

get row index and col name: image

`

  async commitCell(e){
    var viewData = await this.$refs.vgrid.$el.getVisibleSource()
    viewData[this.gRowIndex][this.gColName]=e.target.value
    /* focusout for without not click any where*/
    await this.$refs.vgrid.$el.clearFocus()
  },
  beforeEditStart(e){
    this.gRowIndex=e.detail.rowIndex
    this.gColName=e.detail.prop
  },

`

try it v:^3.3.0

MattTheCuber commented 7 months ago

Any update on a fix for this issue (without using workarounds)?

revolist commented 2 months ago

ApplyOnClose prop introduced https://rv-grid.com/guide/api/revoGrid.html