Re: Sub-components woes
Re: Sub-components woes
- Subject: Re: Sub-components woes
- From: Chuck Hill <email@hidden>
- Date: Wed, 14 Nov 2012 18:16:10 -0800
I have had this happen to me before, but I don't recall why. Logging out a stack trace (or setting a breakpoint if you are feeling modern) when setQtyForSynthManifestTransaction is called with a null value is the quickest way to solve this.
Chuck
On 2012-11-14, at 6:14 PM, email@hidden wrote:
>
>
> Envoyé de mon iPhone
>
> Le 2012-11-14 à 21:00, "Chuck Hill" <email@hidden> a écrit :
>
>> Does BuildManifest have a reset() method.
>
> Yes, I reset the variables that holds the values from the bindings in reset() but I don't do anything for QtyForSynthManifestTransaction in reset()
>
>> What is the stack trace when setQtyForSynthManifestTransaction is called with a null value?
>>
>>
>> On 2012-11-14, at 5:51 PM, Pascal Robert wrote:
>>
>>> I think I still have to understand a couple of things about components. So I have a component that display a table where each row is coming from a WORepetition. Inside each row, I have a column that calls a stateless sub-component:
>>>
>>> <td class="manifest_column">
>>> <wo:BuildManifest selectedProject="$selectedProject" spec="$childSpec.spec" transactions="$~transactionsForSpec(childSpec.spec)" employee="$~employee" rootTransaction="$rootTransaction" />
>>> </td>
>>>
>>> In BuildManifest, I have the following code:
>>>
>>> <wo:loop list="$spec.parts" item="$partItem">
>>> <wo:if condition="$spec.isLotInventory">
>>> <wo:str value="$partItem.serialNumber" />
>>> </wo:if>
>>> <wo:textfield value="$qtyForSynthManifestTransaction" size="4" numberformat="#" style="padding: 0px; margin: 0px;" />
>>> <wo:if condition="$spec.isLotInventory">
>>> <wo:AjaxSubmitButton updateContainerID="$spec.inventoryNumber" value="SM" action="$~createSyntheticTransactionFromPart(partItem)" /> <br />
>>> </wo:if>
>>> <wo:else>
>>> <wo:AjaxSubmitButton updateContainerID="$spec.inventoryNumber" value="SM" action="$~createSyntheticTransactionFromSpec()" /> </wo:else>
>>> </wo:loop>
>>>
>>> qtyForSynthManifestTransaction is a Integer, with a setter and a getter in BuildManifest.java. Now, if I submit the form, setQtyForSynthManifestTransaction is called with the value that I submitted, that's fine, but the setter is called a second time, and it sets the value to null, so when createSyntheticTransactionFromSpec or createSyntheticTransactionFromPart are finally called, the quantity is set to null!
>>>
>>> I have put a breakpoint on the awake method in BuildManifest, and awake() is called as many time as I have rows in my table. So for example, if I had 10 rows, BuildManifest is called 10 times. After the first awake, setQtyForSynthManifestTransaction is called to the correct value, after than awake() is called a couple of times and boum! setQtyForSynthManifestTransaction is called with a null value!
>>>
>>> So what's the trick?
>>>
>>>
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list (email@hidden)
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden
>>
>> --
>> Chuck Hill Senior Consultant / VP Development
>>
>
>> Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
>> http://www.global-village.net/gvc/practical_webobjects
>>
>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
>> Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
>>
>>
>>
>>
>>
>>
>>
>>
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/gvc/practical_webobjects
Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest Growing Companies in B.C!
Global Village Consulting ranks 76th in 24th annual PROFIT 200 ranking of Canada’s Fastest-Growing Companies by PROFIT Magazine!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden