ebailey78 / shinyBS

Twitter Bootstrap Components for Shiny
182 stars 47 forks source link

Creating better tooltips/popovers for elements with sub-choices. #70

Open RohdeK opened 8 years ago

RohdeK commented 8 years ago

Hello, my name is Konstantin and I recently answered to an issue on stackoverflow here, from where I got the idea to propose a pull request.

There, the user requested to add tooltips/popovers from shinyBS onto singular choices of radioButtons and not only the whole radioButton element. Now, I got much further into shinyBS and wrote a small extension, which adds those features for groupInputs (that is radioButton and checkboxGroup) and selectizeInputs.

The main aim was to create tooltips/popovers to a certain choice of such an element. In effect and design, the resulting functions remain very similar to the original bsPopover/bsTooltip functions. They just take an additional value (the specific choice which should be highlighted) and differ mostly in the JavaScript selection algorithm. I tried hard to match the language and style of the work you guys have done so far.

Also, I tried/managed to supply both the ui-sided as well as the server-sided versions to create and delete tooltips/popovers, just like the regular bsTooltip/bsPopover.

While groupInputTooltip/-Popover is very straight-forward, selectizeTooltip/-Popover needs some additional machinery, using observers, to re-enact tooltips/popovers whenever the DOM is changing. Those observers have to be stored in a collection, such that they can be disconnected, if the tooltip/popover is to be removed.

I already did a lot of testing on the way and everything has been working well. There should be no conflict with the rest of the package. I'd appreciate if you'd try out my functions and see if this is worth including into your package.

Best regards, Konstantin Rohde

adefelicibus commented 2 years ago

Hi, is it possible to use this feature? Thanks