Skip to content

Server-side tab select #14

@ivokwee

Description

@ivokwee

Hi John. I cooked up a server-side selectBigTab() function (not unlike updateTabsetPanel(...,selected=) ) to navigate to a certain tabpanel using server-side R. Can you check and see how to put it correctly in the codebase? Thanks a 1e6.

R code:

selectBigTab <- function(session, selected) {
  shiny:::validate_session_object(session)
  message <- shiny:::dropNulls(list(value = selected))
  session$sendCustomMessage("select-tab", message)
}

JS code:

Shiny.addCustomMessageHandler('select-tab', (msg) => {
    console.log('msg.value' + msg.value)
    $(`.tab-trigger[data-target=${msg.value}]`).trigger('click');
});

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions