Update Selected Dynamic Multi Selector Values ​​in Pentaho-CDE

Short version: How can I dynamically reassign the selected value of a dynamically generated multi selector to the default value using JavaScript or JQuery if certain conditions are met when changing (user choice) in another?

Long version:

I have three levels of multi-selectors (State, Metro Area (aka MSA), district) that are dynamically dependent on each other, so that only districts and metro zones crossing selected states are displayed in the corresponding selectors.

My problem is that if I select the MSA inside, say, Maryland, and then click on Texas, my table in which the multi-selector filter is reset (parameterized MDX query).

Going through the error logs in Pentaho catalina.out, it seems that the MSA (Metro Area) selector parameter becomes undefined when a state that does not contain the previously selected MSA is selected.

I would like to make sure that when you select a new state or group of states that do not include the selected MSA or constituencies, these selectors return to the default value ("All"). I am jQuery and newby JavaScript , so I need as much detail as possible, but be careful about your time.


Additional information, if necessary:

The values ​​in the MSA (Metro Area) selector change depending on the selected state (s), and the district selector depends on the state and subway zone. All this happens on the HTML page (created by the Pentaho CDE Dashboard). The data source for each is a parameterized SQL query (executed by Pentaho).

When the All option is selected for county and MSA, I can safely change the state selection: working

If something other than the All option is selected for county and MSA, I cannot change the state change without a dashboard failure: crashing

The data coming from SQL is a two-column array with formatting in MDX format and a label with text with a full value to indicate the parent value of "All" MDX.

+5
source share
2 answers

If you do not attach much importance to the context, I cannot give you a very specific answer, so I hope that you will be enough:

$('.one-input').change(function() { if ($(this).val() == 'something') { $('.other-input').val('default-value'); } }); 
+2
source

I decided. Most of the code was specific to Pentaho-CDE, namely because instead of trying to directly change the value of the selector, I set a listener for a parameter that stores the value of the selector in the selector itself and changes it.

I placed the code below in Pentaho-CDE as a JS resource, then used the @ renaw.change () option to dynamically update all my components, the selected values ​​to the default value, if their previously selected value disappears from the new available set of options.

 $(document).ready(function() { // set default value to start with var all_msas = "[Metro Area]"; var all_counties = "[County]"; var all_zips = "[ZIP]"; Dashboards.fireChange("msa_param", all_msas); Dashboards.fireChange("county_param", all_counties); Dashboards.fireChange("zip_param", all_zips); // what happening on select $("#stateSelectorRow").on("change", function () { Dashboards.fireChange("msa_param", all_msas); Dashboards.fireChange("county_param", all_counties); Dashboards.fireChange("zip_param", all_zips); }); $("#msaSelectorRow").on("change", function () { Dashboards.fireChange("county_param", all_counties); Dashboards.fireChange("zip_param", all_zips); }); $("#countySelectorRow").on("change", function () { Dashboards.fireChange("zip_param", all_zips); }); }) 
+1
source

All Articles