All Apps and Add-ons
Highlighted

CheckboxGroupView - check all

Communicator

Hello,

I'm currently working with the splunk web framework in v6 and I'm using the CheckboxGroupView. I'd like to know if there is a way to check all checkboxes a the same time with this object.

So far I can use a javascript to do a check all as below, but the CheckboxGroupView object isn't refreshed (we can see that it is ticked, but the object underneath isn't set accordingly):

$(':checkbox').each(function() {
    this.checked = $that.is(':checked');
});

Do you know if there is another way to do a tick all? or a way to refresh CheckboxGroupView object?

Regards,
Olivier

0 Karma
Highlighted

Re: CheckboxGroupView - check all

Splunk Employee
Splunk Employee

There is no current simple method to do this, though this is not a bad idea. We'll track this internally as a feature request (both check all and uncheck all).

In the interim, you could do this by selecting all the values manually. The trouble is in getting all the possible values. The only current way is to use something like jQuery to find all the choice elements and get their value tag, but this is not guaranteed to be forwards-compatible if we change the underlying internal markup.

0 Karma
Highlighted

Re: CheckboxGroupView - check all

Communicator

Hello Ineeman,

Thank you very much for your reply. I have used JQuery indeed to tick them as mentioned above, but the underlying objects are not refresh. However, I have noticed that if I untick one and then tick it again, all objects underneath gets updated! So this is a work around for me at the moment.

Thanks again.

0 Karma
Highlighted

Re: CheckboxGroupView - check all

Splunk Employee
Splunk Employee

Out of curiousity, does your CheckboxGroupView consist of only a static set of choices or is it being populated by a search?

0 Karma
Highlighted

Re: CheckboxGroupView - check all

Communicator

If you use a $token$ with your CheckboxGroupView you could change the token, and the underlying object will update.

0 Karma