You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by CodeGirl <Mi...@yahoo.com> on 2014/12/09 01:47:16 UTC

Datagrid functions with objects with objects

I have a datagrid with a datagrid column.   Except the data object contains a
data object.   

For instance the object may be 

id:int
transaction:Transaction

and Transaction
id:int
accountid:int

Notice since the datagrid is based upon the object that the datafield is
transaction.accountid

			<mx:DataGridColumn id="accountDC" 
							   headerText="Vendor" 
							   editable="true" 
							   dataField="transaction.accountid"
							   labelFunction="lookupAccountName"
							   visible="{fullDisplay}"
							   width="180"> 


This becomes a problem with generic function such as Lookups and combo boxes
because item[column.dataField] does not work.   ie. 
object[transaction.accountid]

			protected function lookupAccountName(item:Object,
column:DataGridColumn):String
			{
				return accounts.lookupAccountName(item, column.dataField);
			}
			
Is there a way around this so I can continue to use generic functions?




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Datagrid functions with objects with objects

Posted by CodeGirl <Mi...@yahoo.com>.
I down loaded the one from Adobe and used it.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022p9045.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Datagrid functions with objects with objects

Posted by Alex Harui <ah...@adobe.com>.

On 12/9/14, 10:23 AM, "CodeGirl" <Mi...@yahoo.com> wrote:

>IC   Thank You.  You do know I am Michelle Right?  Too bad the avatar is
>male.  Tried to change it but there wasnt one that was female.   Guess I
>will have to download one.

99% of the time I am using the Apache mailing lists and don’t see any
avatars, just plain text.  But I just looked on Nabble and I saw a female
avatar for you.

Hopefully you are finding Nabble/Apache more responsive than the Adobe
forums.

-Alex


Re: Datagrid functions with objects with objects

Posted by CodeGirl <Mi...@yahoo.com>.
IC   Thank You.  You do know I am Michelle Right?  Too bad the avatar is
male.  Tried to change it but there wasnt one that was female.   Guess I
will have to download one.



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022p9042.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Datagrid functions with objects with objects

Posted by Alex Harui <ah...@adobe.com>.
IIUC, your issue is how to deal with using fields from sub-objects in a
ComboBox or similar controls.

IMO, the vast majority of ComboBox and similar controls don’t use fields
from sub-objects so it isn’t clear that we should make everybody pay the
cost of treating labelField as a “dot-path” expression.  That involves
scanning every character in the labelField for the “.” and if 99% of folks
don’t have “.” in the labelField, that’s probably not a good default
behavior because you did all of that scanning for nothing.

And thus, labelFunction was added to handle the sub-object case.  We did
add dot-path handling to DataGrid because DataGrid always works with
objects and never lists of simple values.

Now if you have this sub-object case often, which seems to be the case for
you, it could be worth creating a subclass of ComboBox that borrows the
code from DataGrid that handles dot-path expressions.  Or maybe it would
make sense to add a flag for doing the scanning into the SDK’s default
controls.  As always, you or anyone is welcome to provide such a patch.

-Alex

On 12/9/14, 7:49 AM, "CodeGirl" <Mi...@yahoo.com> wrote:

>The problem is that I have generic combo boxes which also use datafield
>and
>so yes, in this situation, its easy to solve but in the case of my other
>generic custom objects its not.   I only put this example to give an
>example
>of what I am asking rather than post the entire code of a custom combo box
>
>
>
>--
>View this message in context:
>http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-obj
>ects-with-objects-tp9022p9037.html
>Sent from the Apache Flex Users mailing list archive at Nabble.com.


Re: Datagrid functions with objects with objects

Posted by CodeGirl <Mi...@yahoo.com>.
The problem is that I have generic combo boxes which also use datafield and
so yes, in this situation, its easy to solve but in the case of my other
generic custom objects its not.   I only put this example to give an example
of what I am asking rather than post the entire code of a custom combo box



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022p9037.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

Re: Datagrid functions with objects with objects

Posted by "pkumar.flex" <pr...@gmail.com>.
Hi,

do not use "dataField" with "labelFunction". "labelFunction" should work
perfectly in your case.  If this is not working  use "itemRenderer".

On Tue, Dec 9, 2014 at 6:17 AM, CodeGirl [via Apache Flex Users] <
ml-node+s2333346n9022h67@n4.nabble.com> wrote:

> I have a datagrid with a datagrid column.   Except the data object
> contains a data object.
>
> For instance the object may be
>
> id:int
> transaction:Transaction
>
> and Transaction
> id:int
> accountid:int
>
> Notice since the datagrid is based upon the object that the datafield is
> transaction.accountid
>
>                         <mx:DataGridColumn id="accountDC"
>
>  headerText="Vendor"
>                                                            editable="true"
>
>  dataField="transaction.accountid"
>
>  labelFunction="lookupAccountName"
>
>  visible="{fullDisplay}"
>                                                            width="180">
>
>
> This becomes a problem with generic function such as Lookups and combo
> boxes because item[column.dataField] does not work.   ie.
>  object[transaction.accountid]
>
>                         protected function lookupAccountName(item:Object,
> column:DataGridColumn):String
>                         {
>                                 return accounts.lookupAccountName(item,
> column.dataField);
>                         }
>
> Is there a way around this so I can continue to use generic functions?
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022.html
>  To unsubscribe from Apache Flex Users, click here
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cHJhc2hha3VtYXJAZ21haWwuY29tfDF8LTU0MTcyMzE2NA==>
> .
> NAML
> <http://apache-flex-users.2333346.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
*Regards,*
Prashant Kumar* | *Mob.: +91 8408811225




--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/Datagrid-functions-with-objects-with-objects-tp9022p9026.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.