相关疑难解决方法(0)

删除数据表列中的额外填充

你好,我创建了 JQuery DataTables,如下所示:

在此输入图像描述

所以我的问题是如何删除“图片”列中过多的填充?

这就是我初始化表的方式:

$('#violators_tbl').DataTable({
            "aoColumnDefs": [
                { "bSortable": false, "aTargets": [ 2,3 ] },
                { "sWidth": "20%", "aTargets": [ 0 ] },
                { "sWidth": "35%", "aTargets": [ 1 ] },
                { "sWidth": "30%", "aTargets": [ 2 ] },
                { "sWidth": "15%", "aTargets": [ 3 ] },
            ],
        });
Run Code Online (Sandbox Code Playgroud)

这是我向表中添加行的方法:

function update_table(violator){
        var img_str1 = '<img class=\"obj-pic\" src=\"' + Main.Vars.base_path + violator.front_temp_file_path + '\">';
        var img_str2 = '<img style=\"margin-left: 10px;\" class=\"obj-pic\" src=\"' + Main.Vars.base_path + violator.rear_temp_file_path + '\">';
        var …
Run Code Online (Sandbox Code Playgroud)

css jquery datatables

5
推荐指数
1
解决办法
2万
查看次数

R shiny - DT :: renderDataTable列宽

我正在制作一个闪亮的应用程序,并遇到了一个小而刺激性的问题.我生产的部分输出是使用输出DT::renderDataTable.只有两列,第一列的宽度将取决于输入数据集,所以我不想绝对地将宽度固定为任何东西.我已经看过这个帖子,其中一个答案中的代码在某种程度上起作用.但是,如果我第二次按下actionButton,表会自行调整大小以填充输出窗口的整个宽度.

有没有办法防止表再次按下操作按钮后自行调整大小?我知道,只用renderTabletableOutput会解决这个问题,但我喜欢dataTableOutput,并希望使用该功能.

对于MWE:

library("shiny")
library("DT")

mwe_ui <- shinyUI(fluidPage(
    sidebarLayout(
    sidebarPanel(
      titlePanel("Example"),
      sliderInput(inputId = "df",
                  label = "Degrees of Freedom:",
                  min=1 , max=50 , value=1 , step=1
      ),
      actionButton(inputId = "compute1",
                   label = "Sample"
      )
    ),
    mainPanel(
      dataTableOutput( outputId = "summary" )
    )
  )))

mwe_server <- function(input, output) {

  temp01  <- reactive({
    compute1 <- input$compute1
    if( compute1 > 0 ){
      isolate({
        aa <- round( runif(6, 4,20 ) )
        bb <- character() …
Run Code Online (Sandbox Code Playgroud)

r shiny

5
推荐指数
1
解决办法
3044
查看次数

标签 统计

css ×1

datatables ×1

jquery ×1

r ×1

shiny ×1