Oracle APEX radio groups as buttonsets

Oracle APEX radio groups as buttonsets

Buttonsets are sometimes appropriate to represent a choice of selections instead of radio buttons.

I think they look much better – especially when used for smaller lists.

Sub lists can be shown or hidden easily using dynamic actions in APEX 4.

This is what you need to do…

On page zero, add a piece of JavaScript like this:

?View Code JAVASCRIPT
1
2
3
4
5
6
 
$(document).ready(function(){
//Buttonset radio groups
  $(".radio_group").find("br").remove();
  $(".radio_group").buttonset();
});

What does this do?

First it removes the line break that Oracle adds when you create a radio button item in APEX. Next is runs the jqueryUI buttonset method on any items it finds with the class “radio_group”

If you want to have noth radio groups and buttonsets on the same page, then you could have added another class to your soon-to-be-buttonset item such as class=”myButtonset” then targeted it in your jquery code like this:

?View Code JAVASCRIPT
1
2
3
4
5
$(document).ready(function(){
//Buttonset radio groups
  $(".myButtonset").find("br").remove();
  $(".myButtonset").buttonset();
});

Hope this helps someone.

Share

1 comment on this post.
  1. JqJunky:

    Great post, very useful, thanks.

Leave a comment