Interactive grid - radio group in toolbar

Radio group in toolbar of Interactive Grid

function (options) {
  var tgc = options.toolbarData.toolbarFind("actions3").controls;
  // Add a Radio Group to the Toolbar
  // and define the associated action (that does the actual work)
  tgc.push(
    {
      type: "RADIO_GROUP"
      , action: "set-source"
      , id: "P855_SOURCE_SWITCH"
    });

Define the action : The options and what to do on change.

  options.initActions = function (actions) {
    actions.add(
      {
        name: "set-source"
        , choices: [
          { label: "JOP", value: "J" }
          , { label: "Retouren", value: "R" }
        ]
        , action: function (evt, elm) { // Show the current selection
          $("input:radio[name=report_ig_toolbar_set-source]").removeClass("current");
          $("input:radio[name=report_ig_toolbar_set-source][value=" + elm.value + "]").addClass("current");
          // Set the value of the Page Item to the selected value
          $s("P855_SOURCE", elm.value);
        }
      });
  };
  return options;
}