What errors are you getting or what is displayed that is incorrect?

In Royale, the JS runtime does not know about types so if data is XML, I think 
you may have to cast earlier.  IOW:

Original code:
var liveStateInfo:XML = 
XMLList(XML(data.stateInfos.LiveStateInfos).children())[0];

Royale version:
var liveStateInfo:XML = 
XMLList(XML(data).stateInfos.LiveStateInfos.children())[0];

HTH,
-Alex

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

For the other columns rather than the first and second column,  I can live 
without renderer because it works without renderer but does not work with 
renderer.

Equivalent (which works):

                <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-->

Lets leave the first  column for later and what can I do for the second column ?

Here is the equivalent :


                <mx:AdvancedDataGridColumn 
headerText="{resourceManager.getString('messages', 'stateGrid')}" 
width="{this.pinaraJobList.width * 0.10}">
                    <mx:itemRenderer>
                        <fx:Component>
                            <s:MXAdvancedDataGridItemRenderer>
                                <s:layout>
                                    <s:VerticalLayout horizontalAlign="center" 
verticalAlign="middle"/>
                                </s:layout>
                                <jobdetail:StateImageItem id="stateImageItem" 
data="{data}"/>
                            </s:MXAdvancedDataGridItemRenderer>
                        </fx:Component>
                    </mx:itemRenderer>
                </mx:AdvancedDataGridColumn>




And the source of the included class StateImageItem :

<?xml version="1.0" encoding="utf-8"?>
<s:VGroup 
xmlns:fx="http://ns.adobe.com/mxml/2009";<https://nam04.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Fmxml%2F2009&data=02%7C01%7Caharui%40adobe.com%7C55b48168d7e8400bfe4d08d7c26efa93%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637191654225992621&sdata=he%2BixlQ2w1J5k5k66JOdVnFFzFQUgEg%2BQiDR%2FnDdDLE%3D&reserved=0>
          xmlns:s="library://ns.apache.org/royale/spark"
          xmlns:mx="library://ns.apache.org/royale/mx">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <fx:Script>
        <![CDATA[
            import com.likya.pinara.containers.ImageContainer;
            import com.likya.pinara.containers.ToolTipContainer;

            [Bindable]
            public var data:Object;

            public function mylabelFunc(data:Object):String {
                var liveStateInfo:XML = 
XMLList(XML(data.stateInfos.LiveStateInfos).children())[0];

                var retStr:String = "";

                if(liveStateInfo.StateName != "" || liveStateInfo.StateName != 
null) {
                    retStr = liveStateInfo.StateName;
                }

                if(liveStateInfo.SubstateName != "" || 
liveStateInfo.SubstateName != null) {
                    retStr = retStr + "-" + liveStateInfo.SubstateName;
                }

                if(liveStateInfo.StatusName != "" || liveStateInfo.StatusName 
!= null) {
                    retStr = retStr + "-" + liveStateInfo.StatusName;
                }

                return retStr; // 
XMLList(XML(data.stateInfos.LiveStateInfos).children())[0].StateName;
            }

            // {trace('XML : ' + 
XMLList(XML(data.stateInfos.LiveStateInfos).children())[0].StateName)}
        ]]>
    </fx:Script>

    <s:Image source="{ImageContainer.resolveStatus(data)}" 
toolTip="{ToolTipContainer.getToolTip(data) + ':' + mylabelFunc(data)}"/>

</s:VGroup>

7.03.2020 09:35 tarihinde Alex Harui yazdı:
What is the equivalent code you are trying with mx:AdvancedDataGrid?

textAlign should be left by default.  Do you set it to other values?  If not, 
then you don’t need to specify a renderer.  If you do, then we can add 
textAlign to the emulation.

-Alex

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


7.03.2020 09:05 tarihinde Serkan Taş yazdı:
Showing flex view and flex source for reference.



[cid:image001.png@01D5F4C6.E2864550]

For the first column I use GridItemRenderer

                <s:GridColumn 
headerText="{resourceManager.getString('messages', 'stateGrid')}" 
width="{this.pinaraJobList.width * 0.10}">
                    <s:itemRenderer>
                        <fx:Component>
                            <s:GridItemRenderer>
                                <s:layout>
                                    <s:VerticalLayout horizontalAlign="center" 
verticalAlign="middle"/>
                                </s:layout>
                                <jobdetail:StateImageItem id="stateImageItem" 
data="{data}"/>
                            </s:GridItemRenderer>
                        </fx:Component>
                    </s:itemRenderer>
                </s:GridColumn>

For the second column I use my own class which extends from GridItemRenderer

                <s:GridColumn 
headerText="{resourceManager.getString('messages', 'manageGrid')}" width="150" 
maxWidth="250" id="mngColumn">
                    <s:itemRenderer>
                        <fx:Component>
                            <jobdetail:PinaraJobListGridManageColumn 
selectedGroupId="{outerDocument.selectedGroupId}" />
                        </fx:Component>
                    </s:itemRenderer>
                </s:GridColumn>

For the others need alignment I use DefaultGridItemRenderer

                <s:GridColumn dataField="@Id" 
headerText="{resourceManager.getString('messages', 'jobIdGrid')}" 
sortDescending="false" sortCompareFunction="Transformer.compareIds" 
width="{this.pinaraJobList.width * 0.06}">
                    <s:itemRenderer>
                        <fx:Component>
                            <s:DefaultGridItemRenderer textAlign="left" />
                        </fx:Component>
                    </s:itemRenderer>
                </s:GridColumn>


Three cases here. If it is clear than I will try to tell why it does not work.








Reply via email to