splunk / splunk-webframework

Splunk Web Framework
http://dev.splunk.com
Apache License 2.0
51 stars 13 forks source link

setting the dropdown value in JS doesn't work #6

Open anotomoniz-r7 opened 10 years ago

anotomoniz-r7 commented 10 years ago

I've been trying to set the value of a dropdown in JavaScript, but to no avail. I've tried using both splunkjs.mvc.Components.getInstance("foo_dropdown").val("foo") and splunkjs.mvc.Components.getInstance("foo_dropdown").settings.set("value", "foo"), but both give me the same error: Uncaught TypeError: Cannot read property 'text' of null.

Other than this, the object seems to be working correctly, including accessing the current value through both splunkjs.mvc.Components.getInstance("foo_dropdown").val() and splunkjs.mvc.Components.getInstance("foo_dropdown").settings.get("value"). Additionally, setting the initial value in the template tag using {% dropdown id="foo_id" value="foo" %} works properly. It's just using the JS to change the value that's causing this problem.

davidfstr commented 10 years ago

I've filed this internally. It might take a while for a response since new folks are working on the framework now.

nicholasfilippi commented 9 years ago

Have you taken a look at the Web Framework Toolkit app?

It include several examples, including ones that describe the population of form inputs. For example:

// Set up choices            
var choices = [
        {label: " One", value: "One"},
        {label:" Two", value: "Two"}, 
        {label:" Three", value: "Three"}];

// Assign them to the button group
splunkjs.mvc.Components.getInstance("example-radiogroup").settings.set("choices", choices);    
r2d2c3p0 commented 7 years ago

Hi,

How can I change view from vertical to horizontal for the radio buttons inside the dashboard panels?