subcondition value not changing when calling setCondition

I have a model with a condition that contains a subcondition - both conditions have names and are marked as filterable off.  I’ve added a filter to a table and everything works as expected when changing the filter value on the table itself.  

Due to the nature of the values in the filter (the text is long and needs more width than the lookup filter accommodates - a cssclass option on individual filters would be nice :)), I’m adding another field on the page (currently using a field editor but have rolled a custom component renderer with the same result described below) that is associated with a different model of the same object type as the filter.  I have then hooked a listener on the model for the stand-alone field which takes the value specified and updates the condition by calling setCondition.

Upon initial page load, if I establish a value in the stand-alone field, the condition successfully updates to the appropriate value and I see the table filter change to the correct value specified.  However, any subsequent attempt to pick a different item from the standalone field and set the condition value seems to do nothing - no javascript errors and the data in the condition of the field itself remains the same (inspecting through the DOM).  I have tried setting the table filter to “Default condition and others” and then specified to activate the parent condition but this did not do the trick.

Here is the code that listens for changes and updates the condition

var POItemModel = skuid.model.getModel(‘POItemSearch’);     
var POItem = POItemModel.getFirstRow();
var ExistingPOModel = skuid.model.getModel(‘ExistingPO’);
var masterItemCondition = ExistingPOModel.getConditionByName(‘MasterItemId’, true);      var masterItemListener = new skuid.ui.Field(POItem, POItemModel, null, {fieldId:‘MasterItem__c’, register:true});
      masterItemListener.handleChange = function(newMasterItemId){
          ExistingPOModel.setCondition(masterItemCondition, newMasterItemId);
          ExistingPOModel.updateData();
};

Am I missing a step?  Is the process of updating a subcondition value different than a primary condition?

One other item of note is that i have a second field that follows the same process and it works as expected when setting the standalone field.  The difference between the two standalone fields is that the one encountering the issue has a sub-condition.

Thank you!

With some help from Zach (thanks Zach!), the above has been solved.  In short, obtaining a reference to the condition with the handleChange event as opposed to outside was the key.


var POItemModel = skuid.model.getModel('POItemSearch'); var POItem = POItemModel.getFirstRow(); var ExistingPOModel = skuid.model.getModel('ExistingPO'); var masterItemListener = new skuid.ui.Field(POItem, POItemModel, null, {fieldId:'MasterItem__c', register:true}); masterItemListener.handleChange = function(newMasterItemId){ var poIdCondition = ExistingPOModel.getConditionByName('ExistingPOPOId'); var masterItemCondition = ExistingPOModel.getConditionByName('ExistingPOMasterItemId', true); if (newMasterItemId) { ExistingPOModel.activateCondition(poIdCondition); ExistingPOModel.setCondition(masterItemCondition, newMasterItemId); } else { ExistingPOModel.deactivateCondition(poIdCondition); } ExistingPOModel.updateData(); };