I didn’t notice earlier that you were using s:DefaultGridItemRenderer instead 
of just s:GridItemRenderer.  I would think the default ADG item renderer would 
be sufficient.  What happens if you don’t specify any item renderer instead of 
s:DefaultGridItemRenderer?

-Alex

From: Serkan Taş <serkan....@likyateknoloji.com>
Date: Friday, March 6, 2020 at 12:26 AM
To: Alex Harui <aha...@adobe.com>, "users@royale.apache.org" 
<users@royale.apache.org>
Subject: Re: Grid does not load data

It is a little bit complex Alex let me try to clarify :


========================================================
Flex :
========================================================

There are two types of column used in my code for the spark ADG :  Nested and 
simple

e.g :

                <s:GridColumn dataField="baseJobInfos.jsName" 
headerText="{resourceManager.getString('messages', 'jobNameGrid')}" 
width="{this.pinaraJobList.width * 0.10}">
                    <s:itemRenderer>
                        <fx:Component>
                            <s:DefaultGridItemRenderer textAlign="left" />
                        </fx:Component>
                    </s:itemRenderer>
                </s:GridColumn>
                <s:GridColumn dataField="job_command_type" 
sortCompareFunction="Transformer.compareSortString" 
labelFunction="getJobCommandType" 
headerText="{resourceManager.getString('messages', 'jobCommandTypeGrid')}" 
width="{this.pinaraJobList.width * 0.12}"/>
                  <s:GridColumn dataField="@groupId" 
headerText="{resourceManager.getString('messages', 'jobGrupIdGrid')}" 
width="{this.pinaraJobList.width * 0.10}"/>

The first nested one which has nested tag gets the the column label from  
dataField="baseJobInfos.jsName" which is the the node of xml data which is set 
to dataProvider of ADG.

The second without nested has two cases :

Getting xml node and getting xml attrbiute.

xml attbiute works with dataField but not worked for xml node so added 
labelFunction.


   node get the data from label function which is defined as below :

            public function getJobCommandType(item:Object, 
column:GridColumn):String {
                return item.baseJobInfos.jobTypeDetails.jobCommandType;
            }

Here is the view (column mapping) :

Note :
Nested :                 dataField="baseJobInfos.jsName"                        
                                                                                
   => "İş Adı"
Without nested :  labelFunction="getJobCommandType"     => 
item.baseJobInfos.jobTypeDetails.jobCommandType;  => "İş Komut Tipi"

Without nested :   dataField="@groupId"                                      => 
item.baseJobInfos.jobTypeDetails.jobCommandType;  => "Group No"

[cid:image001.png@01D5F395.81FFCF80]



========================================================
Royale MX ADG :
========================================================

When I turned to MX ADG things changed a bit.

For the simple column without nested element :

dataField did not work for mx ADG for xml attributes like "@attribute" 
(displayed undefined as label)

but worked for nodes like flex through label function so used labelFunction for 
all nodes and attributes.


                <mx:AdvancedDataGridColumn labelFunction="getJsName" 
headerText="{resourceManager.getString('messages', 'jobNameGrid')}" 
width="{this.pinaraJobList.width * 0.10}">
                    <mx:itemRenderer>
                        <fx:Component>
                            <s:MXAdvancedDataGridItemRenderer 
textAlign="center" />
                        </fx:Component>
                    </mx:itemRenderer>
                </mx:AdvancedDataGridColumn>
                <mx:AdvancedDataGridColumn labelFunction="getJobCommandType" 
sortCompareFunction="compareSortString" 
headerText="{resourceManager.getString('messages', 'jobCommandTypeGrid')}" />
                <mx:AdvancedDataGridColumn labelFunction="getGroupId" 
headerText="{resourceManager.getString('messages', 'jobGrupIdGrid')}" />


Label Functions :

            public function getJsName(item:Object, 
column:AdvancedDataGridColumn):String {
                return XML(item).baseJobInfos.jsName;
            }

            public function getJobCommandType(item:Object, 
column:AdvancedDataGridColumn):String {
                return XML(item).baseJobInfos.jobTypeDetails.jobCommandType;
            }

            public function getGroupId(item:Object, 
column:AdvancedDataGridColumn):String {
                return item.@groupId;
            }


Royale view :

[cid:image002.png@01D5F395.81FFCF80]

For the result, the nested column definition without any label member works 
correctly with labelFunction in flex but not in royale.

I sent you the links for the royale source for test purposes.

Thanks,
Serkan
6.03.2020 10:04 tarihinde Alex Harui yazdı:
I am not very familiar with s:GridItemRenderer.  Are you saying that it would 
display text without any child tags?  Looking at the code, it doesn’t look like 
it would.  I thought both s:GridItemRenderer and 
s:MXAdvancedDataGridItemRenderer need a child Label to display something.

-Alex



Reply via email to