我发现这个答案非常非常有帮助,但如何使其适应两个或更多列是否有可能限制可用于可编辑数据表中的值?谢谢你我尝试扩展输入类型,但它不工作。
a11xaf1n1#
使用以下代码段:
callback = JS( "var tbl = $(table.table().node());", "var id = tbl.closest('.datatables').attr('id');", "function onUpdate(updatedCell, updatedRow, oldValue) {", " var cellinfo = [{", " row: updatedCell.index().row + 1,", " col: updatedCell.index().column + 1,", " value: updatedCell.data()", " }];", " Shiny.setInputValue(id + '_cell_edit:DT.cellInfo', cellinfo);", "}", "table.MakeCellsEditable({", " onUpdate: onUpdate,", " columns: [0,1,2],", " inputCss: 'my-input-class',", " confirmationButton: {", " confirmCss: 'my-confirm-class',", " cancelCss: 'my-cancel-class'", " },", " inputTypes: [", " {", " column: 0,", " type: 'list',", " options: [", " {value: 1, display: '1'},", " {value: 10, display: '10'},", " {value: 100, display: '100'},", " ]", " },", " {", " column: 1,", " type: 'list',", " options: [", " {value: 1, display: '1'},", " {value: 10, display: '10'},", " {value: 100, display: '100'},", " ]", " },", " ]", "});" )
字符串
1条答案
按热度按时间a11xaf1n1#
使用以下代码段:
字符串