Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45217

Allow custom title in Dropdown

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • blueocean-plugin
    • None
    • Blue Ocean 1.2-beta2

      I have a labelFunction that returns a html element, which is fine for the dropDown options but for the dropDown title that is no good.

              const parseOption = (option) => {
                  // do we have the default option?
                  const selected = defaultValue && defaultValue[0] && defaultValue[0].displayName === option;
                  // what css clases to use
                  const spanClass = selected ? '' : 'not-selected';
                  return (<span className={spanClass}>
                      { selected && <img
                          src={`${staticResourcePath()}/icons/done.svg`}
                          className="selected"
                          title="selected"
                      /> }
                      { option }
                  </span>);
              };
      

      Since the dropDown use the labelFunction to as well render the title of the button I need a way to define a custom title.

      <Dropdown
                      options={dropOptions}
                      title={ label }
                      labelFunction={parseOption}
                      defaultOption={ label } />
      

            tscherler Thorsten Scherler
            tscherler Thorsten Scherler
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: