cancel
Showing results for 
Search instead for 
Did you mean: 

Use Template feature in sap.m.table with xml view

Former Member
0 Kudos

Hi,

I am adding all columns and items data of sap.m.table declaratively other than first column for which column should display data as hyperlink.Hyperlinks will call different applications based on customdata property attached.

Please help me to convert to xml view as I am facing a bit difficulty to attach template to column.

oTable.addColumn(new sap.m.table.Column({

            label : new sap..commons.Label({

                text : "LinkColumn",

                wrapping : true

            }),

            template : new sap.ui.commons.Link({

                tooltip : "Click to go the details page",

                press : this.getController().goToDetails

            }).bindProperty("text", "User").addCustomData(new sap.ui.core.CustomData({

                key : "step",

                value : "{step}"

            })).addCustomData(new sap.ui.core.CustomData({

                key : "action",

                value : "{step}"

            })).

            })),

Regards,

Koti Reddy

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

How about this:


<Table items="{/yourData}">

    <columns>

        <Column>

            <Label text="LinkColumn" />

        </Column>

        <!-- etc -->

    </columns>

    <items>

        <ColumnListItem>

            <cells>

                <Link text="{user}" press="handleLinkPress">

                    <customData>

                        <core:CustomData key="step" value="{step}" />

                        <core:CustomData key="action" value="{step}" />

                    </customData>

                </Link>

                <!-- etc -->

            </cells>

        </ColumnListItem>

    </items>

</Table>

As 'customData' is an aggregation of the control, you should add it as such. And since the 'CustomData' object is in a different namespace as sap.m, you should adapt the xmlns accordingly (I have prefixed it here as 'core')

Former Member
0 Kudos

Thank You Robin!!

Answers (1)

Answers (1)

former_member182862
Active Contributor
0 Kudos

HI Koti

Is there a reason why are using mixing sap.m and sap.ui.commons controls?

-D

Former Member
0 Kudos

Hi Dennis,

I think you referred to sap.ui.commons.link template under sap.m.table definition. Actually I didn't mix up controls but for sample code I posted sap.ui.commons table code and just changed table property to sap.m.table and forgot to change other controls to mobile library in this post.

I used only mobile library only in my code   Thanks for reminding.

Regards,

Koti Reddy

former_member182862
Active Contributor
0 Kudos

Great!

Thanks

-D