You need to sign in to do that
Don't have an account?
Joey Ho
Does a MAP automatically update in VF page using a LIST?
Hi All,
This is not a problem as such but rather something that I do not quite understand.
I have writted an apex and visualforce code that has operated correctly but I do not undertand why! Hope someone can clarify my misunderstanding?
I have a apex Controller class that has a inner custom wrapper class of objects that I called "AssetLine".
To make things simple, I used maps<string, AssetLine> where the key is the unique string name for each AssetLine.
Now I created a visualforce page which dumps out using <Apex:repeat> a LIST of AssetLine which obviously comes from the Map I created earlier. In this visualforce page contains inputText fields which allow me to manimulate the AssetLine individually and update the instance dynamically.
The ODD THING IS THIS: whenever I update the values in the inputText fields, these fields automatically update the corresponding Map<string, AssetLine> without me having to write any such code in the apex controller telling the LIST to update the corresponding AssetLine in the Map...
How is this possible that the MAP is automatically updated??!!!?
Thanks.
Regards,
Joey Ho
This is not a problem as such but rather something that I do not quite understand.
I have writted an apex and visualforce code that has operated correctly but I do not undertand why! Hope someone can clarify my misunderstanding?
I have a apex Controller class that has a inner custom wrapper class of objects that I called "AssetLine".
To make things simple, I used maps<string, AssetLine> where the key is the unique string name for each AssetLine.
Now I created a visualforce page which dumps out using <Apex:repeat> a LIST of AssetLine which obviously comes from the Map I created earlier. In this visualforce page contains inputText fields which allow me to manimulate the AssetLine individually and update the instance dynamically.
The ODD THING IS THIS: whenever I update the values in the inputText fields, these fields automatically update the corresponding Map<string, AssetLine> without me having to write any such code in the apex controller telling the LIST to update the corresponding AssetLine in the Map...
How is this possible that the MAP is automatically updated??!!!?
Thanks.
Regards,
Joey Ho
The thing still gets me is that although I am using a LIST<AssetLine> to dump out in a <apex:repeat> tag, I still don't see how the map<string, AssetLine> knows which AssetLine was altered. I am guessing that the LIST<AssetLine> references the same "memory" address as the map? Cheers.