2017-05-12 72 views
1

我在我的test.Rmd以下代碼。轉到其他頁面的flexdashboard點擊閃亮actionbutton

--- 
title: "Test Application" 
runtime: shiny 
output: 
    flexdashboard::flex_dashboard: 
    orientation: rows 
    vertical_layout: fill 
--- 

sidebar {.sidebar} 
========================== 

Controllers 
----------------------- 
```{r} 
actionButton("clickMe", label = "Click Me", class = "btn btn-lg btn-primary") 
``` 

Page1 
======================== 

Page2 
======================= 

最初,我的應用程序是在第1頁。我要帶我的應用程序第2頁上單擊按鈕clickMe。請在這件事上給予我幫助..!

回答

3

可以使用onClick說法是這樣的:

actionButton("clickMe", label = "Click Me", class = "btn btn-lg btn-primary", 
      onclick="location.href='#section-page2';") 
+0

真好!僅供參考:他們可能也對您的解決方案感興趣:https://groups.google.com/forum/#!topic/shiny-discuss/pa7Y7RkcJ8M – BigDataScientist

+0

謝謝,這對我有幫助。我正在使用模塊,所以我必須使用'...'選項創建'UI',以便我可以從主應用程序傳遞'onclick'事件。 – TheRimalaya