Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable/disable f7Tab #10

Open
kmezhoud opened this issue Feb 5, 2021 · 0 comments
Open

enable/disable f7Tab #10

kmezhoud opened this issue Feb 5, 2021 · 0 comments

Comments

@kmezhoud
Copy link

kmezhoud commented Feb 5, 2021

Hi,

I'm looking for the class of the f7tab to enable/disable toggle tab-links.
Thanks

library(shinyMobile)
library(shinyjs)
library(shiny)

shiny::shinyApp(
  ui = f7Page(
    title = "Tab Layout",
    options = list(theme= "auto", dark= FALSE, filled=FALSE),
    f7TabLayout(
      navbar = f7Navbar(title = 'Navbar' ,shadow = TRUE),
      f7Tabs(
        id = "tabs_id",
        swipeable = FALSE,
        animated = FALSE,
        
        f7Tab(
          tabName = "TAB1",
            active = TRUE,
          
          f7Text(
            inputId = "username_id",
            label = h5("Username:"),
            value = "Foo",#NULL,
            placeholder = "Username"
          ),
          #textInput("userName_db", "User Name:", "root"),
          f7Password(
            inputId = "passwd_id",
            label = h3("Password:"),
            placeholder = "Password"
          ),
          f7Button(inputId = "btn_Login" ,label = "Login" )
        ),
        f7Tab(tabName = "TAB2", "tab 2 text"),
        f7Tab(tabName = "TAB3", "tab 3 text")
      )
    )
  ),
  server = function(input, output) {

   ## disable TAB2 and wait for login 
    shinyjs::disable(selector = "TAB2")

    shinyjs::disable(selector = '.nav-link a[data-value="TAB2"')
    shinyjs::disable(selector = '.nav-tabs a[tabName="TAB2"')
    shinyjs::disable(selector = '.f7-tabbar-link a[tabName="TAB2"')
    shinyjs::disable(selector = '.button tab-link a[tabName="TAB2"')
    shinyjs::disable(selector = '.tablinks a[tabName="TAB2"')
    shinyjs::disable(selector = '.tablinks a[data-value="TAB2"')
    
    observeEvent(input$btn_Login,{
      if(isolate(input$username_id) == isolate(input$passwd_id)){
        print('OK')
        shinyjs::enable(selector = "TAB2")
      }else{
        print("KO")
      }
    })
  
  }
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant