Re: Sub-components woes
Re: Sub-components woes
- Subject: Re: Sub-components woes
- From: Pascal Robert <email@hidden>
- Date: Thu, 15 Nov 2012 07:12:59 -0500
Le 2012-11-14 à 21:07, Johnny Miller <email@hidden> a écrit :
> I too have trouble with this stuff all the time...
>
> if it is a stateless components where does qtyForSynthManifestTransaction get stored?
It's not stored anywhere except in the component, I use this variable in a method in the component and in the text field, and that's it.
> Do you have automatic binding turned off as well?
Yes. And I inherit from ERXStatelessComponent
>
> On Nov 14, 2012, at 3:51 PM, Pascal Robert <email@hidden> 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
>
_______________________________________________
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