Skip to content

Conversation

DivadNojnarg
Copy link
Collaborator

Will fix #19

@DivadNojnarg
Copy link
Collaborator Author

@olajoke A working prototype for implementing MenuColumn:

library(shiny)
library(bslib)
library(palmerpenguins)

ui <- page_fluid(
  cheetahR::cheetahOutput("table")
)

server <- function(input, output, session) {
  output$table <- renderCheetah({
    cheetah(
      penguins
    )
  })
}

shinyApp(ui, server)

@olajoke
Copy link
Collaborator

olajoke commented Apr 15, 2025

@DivadNojnarg Interestingly, I have addressed this same issue in a separate branch (see here). While your approach dynamically applies menuColumn to detected factor columns, mine lets users provide the label/value list directly. Merging our approaches could offer more flexibility. Let's discuss it further tomorrow.

@DivadNojnarg
Copy link
Collaborator Author

DivadNojnarg commented Apr 15, 2025

@olajoke Few comments when I was checking the API:

  • I've seen that Cheetah allows to create a readonly Dropdown menu that does not open (https://future-architect.github.io/cheetah-grid/documents/api/js/column_types/MenuColumn.html). I wonder what is the interest. The dropdown is only of interest when it can be opened. We'd have to account for this.
  • In general, we can pass column type as a string like check, ... However, many example actually use the JS constructors for each type like (to provide more flexibility):
columnType: new cheetahGrid.columns.type.NumberColumn({
        format: new Intl.NumberFormat("en-US", {
          style: "currency",
          currency: "USD",
        }),
      }),
action: new cheetahGrid.columns.action.SmallDialogInputEditor({
        classList: "helper-text--right-justified",
        helperText(value) {
          return `${value.length}/20`;
        },
        inputValidator(value) {
          return value.length > 20
            ? `over the max length. ${value.length}`
            : null;
        },
        validator(value) {
          return value.match(/^[a-zA-Z]*$/) ? null : "Please only alphabet.";
        },
      })

Our refactoring should account for that.

@olajoke olajoke closed this Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

MenuColumn
2 participants