Ticket #3630 (new feature)
Panel: play nicely with multiple classnames for widgets (e.g. "olControlNavigationItemActive myClass")
| Reported by: | ejn | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.13 Release |
| Component: | Control.Panel | Version: | 2.11 |
| Keywords: | panel widget state | Cc: | |
| State: |
Description
The current redraw method for Panel (more precisely, the methods iconOn and iconOff) change the class name on the icon using a regular expression which matches ItemInactive$ or ItemActive$ - i.e. at the end of the whole className string.
In cases where multiple class names are applied to the widgets this regex doesn't work - we need to be matching at end of word, not end of string - and so the widget state doesn't get updated.
Use case is e.g. to simplify CSS I wish to add a class "navigationWidget" to all controls on my panel, leaving them with a className string such as "olControlZoomBoxItemInactive navigationControl".
Suggested regex (unfortunately no lookbehinds in JavaScript so slightly clunky) which should be pretty foolproof:
replace(/\b(olControl[^ ]*Item)Inactive\b/, "$1Active") replace(/\b(olControl[^ ]*Item)Active\b/, "$1Inactive")
The attached patch implements this change.

