Dear List,
I tried to solve the problem of using the AjaxExpansion per row inside a repetition and providing a unique "expanded" flag binding per row. Since each row matches a particular product, the binding of "expanded" is set to the visible flag of each product in the array by using a setter/getter method.
If I use a public instance variable, such as a global "isVisible" flag, this would work like the AjaxExample, but the global instance variable is not suitable for each row in a repetition.
I do not understand why the binding to a setter/getter method would fail?
Thanks for any hints,
-mai
CurrentProductRepetition: WORepetition { item = bundleProductItem; list = currentMainBundleProducts; index = logIndex; } AgreementDetailsAjaxExpansion : AjaxExpansion { id = ~"AgreementDetailsAjaxExpansion" + logIndex; insertion = "Effect.blind"; insertionDuration = "0.1"; string = "Agreement Details"; expanded = isAgreementDetailsVisibleForBundleProductItem; }
In the java file, I have the following simple code:
public boolean isAgreementDetailsVisibleForBundleProductItem() { return (bundleProductItemC.isAgreementDetailsVisible()); }
public void setIsAgreementDetailsVisibleForBundleProductItem(boolean aValue) { bundleProductItemC.setIsAgreementDetailsVisible(aValue); }
== // Methods used in AjaxExpansion for bundle product public boolean isAgreementDetailsVisibleC = false;
public boolean isAgreementDetailsVisible() { return isAgreementDetailsVisibleC; }
public void setIsAgreementDetailsVisible(boolean value) { isAgreementDetailsVisibleC = value; }
However, at runtime, I would get the following exception:
<com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException message '[<CustomerSummary name: CustomerSummary subcomponents: {0.15.13.7.1.5.0.1.3 = <er.ajax.AjaxExpansion name: er.ajax.AjaxExpansion subcomponents: null >; 0.15.13.7.1.7 = <er.ajax.AjaxModalDialog name: er.ajax.AjaxModalDialog subcomponents: null >; } > takeValueForKey()]: attempt to assign value to unknown key: 'isAgreementDetailsVisibleForBundleProductItem'. This WOComponent does not have an instance variable of the name isAgreementDetailsVisibleForBundleProductItem or _isAgreementDetailsVisibleForBundleProductItem, nor a method of the name setIsAgreementDetailsVisibleForBundleProductItem or _setIsAgreementDetailsVisibleForBundleProductItem' object '<CustomerSummary name: CustomerSummary subcomponents: {0.15.13.7.1.5.0.1.3 = <er.ajax.AjaxExpansion name: er.ajax.AjaxExpansion subcomponents: null >; 0.15.13.7.1.7 = <er.ajax.AjaxModalDialog name: er.ajax.AjaxModalDialog subcomponents: null >; } >' key 'isAgreementDetailsVisibleForBundleProductItem'> at com.webobjects.appserver.WOComponent.handleTakeValueForUnboundKey(WOComponent.java:1781) at com.webobjects.foundation.NSKeyValueCoding$Utility.handleTakeValueForUnboundKey(NSKeyValueCoding.java:519) at com.webobjects.foundation.NSKeyValueCoding$_KeyBinding.setValueInObject(NSKeyValueCoding.java:899) at com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.takeValueForKey(NSKeyValueCoding.java:1354) at com.webobjects.appserver.WOComponent.takeValueForKey(WOComponent.java:1748) at com.webobjects.foundation.NSKeyValueCoding$Utility.takeValueForKey(NSKeyValueCoding.java:469) at com.webobjects.foundation.NSValidation$DefaultImplementation.validateTakeValueForKeyPath(NSValidation.java:679) at com.webobjects.appserver.WOComponent.validateTakeValueForKeyPath(WOComponent.java:1424) at com.webobjects.appserver._private.WOKeyValueAssociation.setValue(WOKeyValueAssociation.java:76) at ognl.helperfunction.WOHelperFunctionKeyValueAssociation.setValue(WOHelperFunctionKeyValueAssociation.java:21) at com.webobjects.appserver.WOComponent.setValueForBinding(WOComponent.java:910) at er.ajax.AjaxExpansion.setExpanded(AjaxExpansion.java:138) at er.ajax.AjaxExpansion.toggle(AjaxExpansion.java:146) |