Hello all. I have a project of which I am binding to an array that is a
member of an object. This array is dynamic and dictates the fields that
are available for this object. For example, the object is called Contact
and the fields array contains entries for the first name, last name,
etc. The reason why we choose not create "static" member variables and
simply bind to them was that users are going to be able to dynamically
create / modify fields. This array stores not only information about the
value of the field but its type, and various other settings.
The solution I came up with (and it works) was to bind to components
like this:
<c:TextInput id="field_contact_firstname"
text="{_contact._fieldDetails.getItemAt(_contact.getFieldIndex('field_co\
ntact_firstname')).value}" valueCommit =
{_contact._fieldDetails.getItemAt(_contact.getFieldIndex('field_contact_\
firstname')).value = field_contact_firstname.text;}" x="154" y="57"
width="190"/>
I would like to condense this by saying something like this:
<c:TextInput id="field_contact_firstname"
creationComplete="fieldInit('field_contact_firstname')"/>
And simply perform setting valueCommit and the text properties in the
fieldInit function.
I seem to have a timing issue here. I cannot use the _contact until it
has fully loaded. It seems in many cases fieldInit gets called before my
_contact fully loads. Now if I initialize the fields after the _contact
is loaded I am risking the object loading before the components are
created. This yield's null object errors potentially on both sides of
the equation.
I have a feeling this post is extremely log winded and there is most
likely a simple solution. Its not the biggest deal right now as it does
work using the former method BUT for future growth managing fields with
the fieldInit function would open up some new possibilities for our
product.
Any idea's?
Thank you!
Nick