render dropdown for single column in DT shiny BUT loaded only on cell click and with replaceData()

后端 未结 1 885
面向向阳花
面向向阳花 2021-01-19 03:41

Goal

  • To have select dropdown in DT datatables not at the building of the datatable but built on cell click, with replaceData() and with the datas
1条回答
  •  礼貌的吻别
    2021-01-19 04:44

    You have to unbind before running replaceData.

    ui <- fluidPage(
      tags$head(tags$script(
        HTML(
          "Shiny.addCustomMessageHandler('unbindDT', function(id) {
            var $table = $('#'+id).find('table');
            if($table.length > 0){
              Shiny.unbindAll($table.DataTable().table().node());
            }
          })")
      )),
      title = 'Selectinput column in a table',
      ......
    

    and in server:

      ......
      session$sendCustomMessage("unbindDT", "foo_dt")
      ReplaceData_foo_dtRefresh (react)
      
    

    0 讨论(0)
提交回复
热议问题