R Shinyhelper的about_me()
函数看不到辅助程序通过class Person
{
protected:
string m_name;
public:
Person(const string &name)
: m_name(name)
{
cout << "Creating Person Class" << endl;
}
void about_me()
{
cout << "I am a person, my name is " << m_name << endl;
}
};
class Student : protected Person
{
private:
int m_id;
string m_school;
public:
Student(const string &name, int id, const string &school)
: Person(name), m_id(id), m_school(school)
{
cout << "Creating Student Class" << endl;
}
void about_me()
{
cout << "I am a student, my name is " << m_name << ", my id is " << m_id << " at " << m_school << endl;
}
};
int main()
{
Person* pperson = new Person("John Doe");
Student* pstudent = new Student("Jane Doe", 12345, "Some School");
pperson->about_me(); // "I am a person, my name is John Doe"
pstudent->about_me(); // "I am a student, my name is Jane Doe, my id is 12345 at Some School"
pperson->about_me(); // "I am a person, my name is John Doe"
((Student*)pperson)->about_me(); // runtime error!
delete pstudent;
delete pperson;
return 0;
}
之类的输出函数传递,这是不幸的,因为它是一个有用的小包装。以下是MWE。
UI
observe_helpers
服务器
htmlOutput
我知道library(shiny)
library(shinyhelper)
ui = fluidPage(
sidebarLayout(
sidebarPanel(
selectInput("var",
label = "var",
choices = c("A", "B", "C", "D")) %>%
helper(icon="question",
type="markdown",
content="herp")),
mainPanel(
htmlOutput("selected"))
))
在通过管道连接到server = function(input, output,session) {
observeEvent(input$var, {
if(input$var=="B"){
output$selected <- renderUI({
fluidRow(
column(4,textInput(inputId="derp",
label="derp") %>%
helper(icon="question",
type="markdown",
content="flerp")),
column(8))})
}})
observeEvent(input$derp, {print(input$derp)})
observe_helpers()
}
runApp(list(ui = ui, server = server))
时有效,但是当我们想在服务器上呈现一个包含多个带有其自己的助手的小部件的UI时,这没有帮助。
任何有关解决此问题的建议将不胜感激。
答案 0 :(得分:0)
您现在可以更新到Shinyhelper v0.3.1,它应该可以解决此问题。