updateNumericInput over a vector of numbers iteratively within ObserveEvent

...I'm making use of EditData package inside Shiny web app to edit or to do minor changes on a dataset. The edit functionality works good but there is an option to select multiple columns to delete but not for edit and i'm trying to incorporate the same for Editing. I'm new here and i tried to change the function according to my need and since i dont have that good knowledge and i'm failing.

I seem to figure out that the function editableDT inside this package is responsible for updating the values from which the Left and Right arrows(action buttons) updates and hence the selection of the rows.

observeEvent(input$left, {
    value = ifelse(input$no > 1, input$no - 1, 1)
    updateNumericInput(session, "no", value = value)
})
observeEvent(input$right, {
    value = ifelse(input$no < nrow(df()), input$no + 1, nrow(df()))
    updateNumericInput(session, "no", value = value)
})

My requirement: If i select multiple rows, the Left and Right buttons should update to only the selected rows. Ex: if i select 2,5 & 8 rows, the edit should start from 2nd, then on to 5th and 8th.

observeEvent(input$right,{

  ids <- input$origTable_rows_selected
  for (i in ids) {
  value = i
  updateNumericInput(session,"no",value=value)
  }
})

I have tried the above code but the selection starts from one and then after pressing the Right, it'll go to the final selected row, in my example 8th row.

editData::editData(mtcars)

in this example, if the "multiple" radio button is selected and after selecting 2,5 and 8th rows and when Edit is called, the edit always starts from 1st row and increments by one to next row or previous after pressing the Right and Left button respectively.

What i need is to increment/decremrent to the next / previous selected rows.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.