2016-05-25 14 views
0

光沢のあるselectinputオプションと同様に、textInputを使用している間に利用可能なオプションを提供する方法はありますか?Shiny - textInput

つまり、ユーザーが文字または文字を入力する場合、その文字または文字内で使用可能なすべてのオプションを指定する必要があります。私にはたくさんのオプションがあるので、selectinputの種類が減速し、入力の良いオプションではありません。したがって、私はtextInputを選択します。

ご意見はお寄せください。あなたはこの意志出力テキストボックス引数で複数= TRUE

selectInput(inputId, label, choices, multiple = TRUE) 

をselectInputを使用するのではなく、ドロップダウンし、ユーザーが文字内で使用可能なすべてのオプションを入力して開始してフィルタリングされますができ

おかげ

+1

おそらく、必要なものを選択してください:http://shiny.rstudio.com/articles/selectize.html –

+0

この質問に対する回答(http://stackoverflow.com/questions/35265920/auto-complete) – ChriiSchee

+0

混乱を明確にするには:デフォルトでは、selectInput()およびselectizeInput()はJavaScriptライブラリselectize.jsを使用します。 selectInput()で 'selectize = FALSE'を指定して基本入力を選択しない限り。ですから皆はすでに '選択 'の異なるモードについて話しています。 [ギャラリー](http://shiny.rstudio.com/gallery/selectize-vs-select.html)および[リファレンス](https://shiny.rstudio.com/reference/shiny/latest/selectInput.html)を参照してください。 – dracodoc

答えて

1

、あなたはいくつかの派手なものを行うことができます。次の例では、入力したテキストを含むすべてのオプションが一覧表示されています。表のセルをクリックすると、テキスト入力が表のセルのテキストで更新されます。また、テーブルの検索フィールドを使用することもできます。

library(shiny) 

shinyApp(
    ui = fluidPage(textInput("text", "Please input text:"), 
       DT::dataTableOutput('tbl')), 

    server = function(session, input, output) { 

    # all your choices for the textfield go into "text" column 
    allData <- data.frame(ID = '', text = c(paste0("Text",1:50))) 

    # table with only the texts that contain input$text 
    output$tbl = DT::renderDataTable(
     allData[grep(input$text, allData$text), ], 
     selection = 'none', 
     rownames = FALSE, 
     options = list(searchHighlight=T) 
    ) 

    # fill textInput after Click in Table 
    observeEvent(input$tbl_cell_clicked, { 
     info <- input$tbl_cell_clicked 

     if (is.null(info$value) || info$col != 1) return() 
     else { 
     updateTextInput(session, "text", value = info$value) 
     } 
    }) 
    } 
) 

enter image description here

0

selectinputは一種のこのケースで最良の選択肢でダウンしていない複数の選択肢を持つ入力

selectInputための良いオプションが遅くなります。遅いローディングは、サーバーにselectInputを移動することで簡単に管理できます。 ui.R

ジャストタイプ:

selectizeInput(inputId=..., label=..., choices = NULL, multiple = TRUE) 

server.Rで:

server <- function(input, output, session) { 
    updateSelectizeInput(session = session,inputId =...,choices=..., server = TRUE)} 

今、あなたが遅い読み込みに問題があってはなりません。

関連する問題