The code below shows how sel1 updates sel2 based on its value.

var dict = {
  'a': {
    'foo': 321 
  'b': {
    'foo': 123

// Callback functions
var updateSel2 = function(k) {
  var sel2Items = Object.keys(dict[k]);
  sel2Items.forEach(function(item) {

var sel2Behavior = function(v) { print(v) };

// Selectors
var sel1 = ui.Select({
  items: Object.keys(dict),
  onChange: updateSel2

var sel2 = ui.Select({
  onChange: sel2Behavior


When sel2 is updated for the first time, the sel2Behavior function works perfectly.

When I change the value of sel1 again, since sel2 will have the same value (foo), the callback function does not work.

What could be the reason? And how can I fix this?

1 Answer 1


At the bottom of updateSel2, call setValue() to reset the value to null (with trigger = false)

sel2.setValue(null, false)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.