首页 \ 问答 \ 关于Oracle 数据库有哪些书值得推荐

关于Oracle 数据库有哪些书值得推荐

更新时间:2024-01-22 19:01

最满意答案

根据DT手册选项,与某些扩展相关联的选项需要放在命名列表中。 如果指定options属性中的options ,则必须指定NULL

datatable(.,extensions=list("ColReorder" = NULL,
                            "ColVis" = NULL,
                            "FixedColumns"=list(leftColumns=2))

由于dom属性不足而生成另一个错误。 有关详细信息, 请参阅此链接dom每个字母都与表输出的指定元素相关联。 与extension相关联的大写字母和与表格元素相关的小写字母( R -Col R eorder, C - C olVis, T -Table T ools, t - t able, i -table i nfo等)。 如果示例'R'缺失,因此Col R eorder无法工作。 使用TableTools将所有代码放在正确的代码下面:

iris %>% 
  datatable(
    extensions = list("ColReorder" = NULL,
                      "ColVis" = NULL,
                      "TableTools" = NULL,
                      "FixedColumns" = list(leftColumns=2)), 
    options = list(autoWidth=TRUE,
                   oColReorder = list(realtime=TRUE),
                   oColVis = list(exclude=c(0, 1),   activate='mouseover'),
                   oTableTools = list(
                   sSwfPath = "//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/swf/copy_csv_xls.swf",
                   aButtons = list("copy","print",
                                   list(sExtends = "collection",
                                        sButtonText = "Save",
                                        aButtons = c("csv","xls")))),
               dom = 'CRTrilftp',
               scrollX = TRUE,
               scrollCollapse = TRUE))

升级! 随着DT升级(v0.1.56)扩展, TableToolsColVis不再可用。 根据上面的新教程 ,扩展可以通过buttons扩展。 新版本的软件包更加一致,添加扩展程序比以前更容易:

 DT:::datatable(
    iris,
    escape=F,
    filter = "top",
    rownames= F,
    extensions = list("ColReorder" = NULL,
                      "Buttons" = NULL,
                      "FixedColumns" = list(leftColumns=1)),
    options = list(
                dom = 'BRrltpi',
                autoWidth=TRUE,
                lengthMenu = list(c(10, 50, -1), c('10', '50', 'All')),
                ColReorder = TRUE,
                buttons =
                  list(
                    'copy',
                    'print',
                    list(
                      extend = 'collection',
                      buttons = c('csv', 'excel', 'pdf'),
                      text = 'Download'
                    ),
                    I('colvis')
                  )
              )
    )

According to the DT manual options associated with some extensions needs to be placed in a named list. If one specifies options in options attribute, then NULL must be assigned.

datatable(.,extensions=list("ColReorder" = NULL,
                            "ColVis" = NULL,
                            "FixedColumns"=list(leftColumns=2))

Another error is generated due to insufficient dom attribute. For more info see this link . Each letter in dom is linked with specified element of table output. Uppercase letters associated with extension and lowercase with table elements (R - ColReorder, C - ColVis, T - TableTools, t - table, i - table info etc.). In case example 'R' is missing, and therefore ColReorder couldn't work. Putting all together below correct code with TableTools added:

iris %>% 
  datatable(
    extensions = list("ColReorder" = NULL,
                      "ColVis" = NULL,
                      "TableTools" = NULL,
                      "FixedColumns" = list(leftColumns=2)), 
    options = list(autoWidth=TRUE,
                   oColReorder = list(realtime=TRUE),
                   oColVis = list(exclude=c(0, 1),   activate='mouseover'),
                   oTableTools = list(
                   sSwfPath = "//cdnjs.cloudflare.com/ajax/libs/datatables-tabletools/2.1.5/swf/copy_csv_xls.swf",
                   aButtons = list("copy","print",
                                   list(sExtends = "collection",
                                        sButtonText = "Save",
                                        aButtons = c("csv","xls")))),
               dom = 'CRTrilftp',
               scrollX = TRUE,
               scrollCollapse = TRUE))

Upgrade! As DT has upgraded (v0.1.56) extensions TableTools and ColVis is no longer available. According to the new tutorial above extension are possible through buttons extension. New version of package is more consistent and adding extensions is easier than before:

 DT:::datatable(
    iris,
    escape=F,
    filter = "top",
    rownames= F,
    extensions = list("ColReorder" = NULL,
                      "Buttons" = NULL,
                      "FixedColumns" = list(leftColumns=1)),
    options = list(
                dom = 'BRrltpi',
                autoWidth=TRUE,
                lengthMenu = list(c(10, 50, -1), c('10', '50', 'All')),
                ColReorder = TRUE,
                buttons =
                  list(
                    'copy',
                    'print',
                    list(
                      extend = 'collection',
                      buttons = c('csv', 'excel', 'pdf'),
                      text = 'Download'
                    ),
                    I('colvis')
                  )
              )
    )

相关问答

更多