Arabirim, UI'nin yüklenmesinden önce göz önünde bulundurulduğu için bir sorunla karşılaşıyorum. İşte R parlak Çalıştırmayı gözlemleyin UI'nin yüklenmesinden önce ve bu durum Null parametrelerine neden olur
İşte benim Server.RshinyServer(function(input, output,session) {
#this is dynamic UI
output$choose_Product <- renderUI({
selectInput("Product", "Product:", as.list(getProductUI(input$Desk)))
})
#this is dynamic UI
output$choose_File1 <- renderUI({
selectInput("File1", "File 1:", as.list(getFileUI(input$Desk, input$Product)))
})
#this is dynamic UI and I want it to run before the Observe function so the call
# to getTerm1UI(input$Desk, input$Product, input$File1) has non-null parameters
output$choose_Term1 <- renderUI({
print("Rendering UI for TERM")
print(paste(input$Desk," ", input$Product, " ", input$File1,sep=""))
selectInput("Term1", "Term:", getTerm1UI(input$Desk, input$Product, input$File1))
})
benim ui.R
sidebarPanel(
selectInput("Desk", "Desk:" , as.matrix(getDesksUI())),
uiOutput("choose_Product"), #this is dynamically created UI
uiOutput("choose_File1"), #this is dynamically created UI
uiOutput("choose_Term1"), #this is dynamically created UI ....
olan Bu benim işlevini gözlemlemek ve giriş $ Ürün ve girdi $ File1 böylece doldurulur önce çalıştırır Bir hata alıyorum çünkü ikisi de NULL. Fakat girişi UI'den kullanmam gerekiyor.
observe({
print("in observe")
print(input$Product)
max_plots<-length(getTerm2UI(input$Desk, input$Product, input$File1))
#max_plots<-5
# Call renderPlot for each one. Plots are only actually generated when they
# are visible on the web page.
for (i in 1:max_plots) {
# Need local so that each item gets its own number. Without it, the value
# of i in the renderPlot() will be the same across all instances, because
# of when the expression is evaluated.
local({
my_i <- i
plotname <- paste("plot", my_i, sep="")
output[[plotname]] <- renderPlot({
plot(1:my_i, 1:my_i,
xlim = c(1, max_plots),
ylim = c(1, max_plots),
main = paste("1:", my_i, ". n is ", input$n, sep = ""))
})
})
}##### End FoR Loop
},priority = -1000)
nasıl çalışır gözlemlemek ÖNCE doldurulması giriş $ Ürün ve girdi $ File1 almak için fikrin var mı?
Teşekkür ederiz.
'observe'' priority = 0' argümanına sahiptir. Belli bir öncelik seviyesine sahip bir gözlemci, her zaman daha düşük öncelik seviyesine sahip tüm gözlemcilerden daha erken bir şekilde yürütecektir. Daha sonra yürütmek istiyorsanız öncelikli negatif yapabilirsiniz. Bu yardımcı olabilir. – jdharrison
Önceliği -100'e ayarlıyorum ve hiçbir şey olmuyor – user3022875