excelR icon indicating copy to clipboard operation
excelR copied to clipboard

Can we use the `onchange` event?

Open daeyoonlee opened this issue 4 years ago • 2 comments

Dear Swechhya,

Can we use the onchange event? I tried the following, but nothing happens when I change the table value.

onchange <- "function(instance, cell, x, y, value) { alert('test'); }"

excelTable(
  data = df,
  editable = TRUE,
  wordWrap = TRUE,
  autoWidth = TRUE,
  autoFill = FALSE,
  lazyLoading = TRUE,
  loadingSpin = TRUE,
  getSelectedData = FALSE,
  columnSorting = FALSE,
  columnResize = FALSE,
  rowResize = FALSE,
  columnDrag = FALSE,
  rowDrag = FALSE,
  allowInsertRow = FALSE,
  allowInsertColumn = FALSE,
  allowDeleteRow = FALSE,
  allowDeleteColumn = FALSE,
  allowRenameColumn = FALSE,
  allowComments = FALSE,
  columns = columns_df, 
  # ...
  tableOverflow = TRUE,
  contextMenu = FALSE,
  defaultColAlign = 'left',
  onchange = htmlwidgets::JS(onchange)
)

daeyoonlee avatar Dec 12 '20 14:12 daeyoonlee

@daeyoonlee the onchange event cannot be overwritten as this function handles the core change in the table. If you could tell me the use case then I could you help with it.

Swechhya avatar Apr 22 '21 09:04 Swechhya

Sorry for the late reply. This is because I wanted to make varius input validation at the client side. for example,

  1. popup warning
  2. typo auto fix
  3. make input NG message to another cell

It can also be performed on the server side, but considering the network response delay, I thought that it would be helpful for the user experience to proceed with JavaScript on the client side.

daeyoonlee avatar Jul 03 '21 11:07 daeyoonlee