Skip to Content

sap.ui.table headerSpan in xml views not working in 1.28.29 or even in higher version

Dear all,

i have a problem that i need to use a multi-header grid table.

When i use setHeaderSpan in javascript it works fine, however when i use headerSpan property of sap.ui.table in the xml view it seem not to work.

Is this a know bug or am i dong something wrong?

Does anyone have an idea how i can extent sap.ui.table.column so i can overcome this issue and set it still in the XML?

I tried also higher version and its not working in XML.

JSBIN with full minimal example code can be found here:

JS Bin - Collaborative JavaScript Debugging

Does not work:

<table:Column id="col2"
         hAlign="Center"
         headerSpan="[2,1]"
         >
            <table:multiLabels>
                  <Label text="Stock" />
                  <Label text="B2" textAlign="Center" class="tableHeaderWrap"/>
            </table:multiLabels>
            <table:template>
                 <Label text="{ShipCity}" />
            </table:template>
         </table:Column>


         <table:Column id="col3"  hAlign="Center">
            <table:multiLabels>
                  <Label text="Stock" />
                  <Label text="B2" textAlign="Center" class="tableHeaderWrap"/>
            </table:multiLabels>
            <table:template>
                 <Label text="{ShipName}" />
            </table:template>
         </table:Column>

Does work:

onInit : function () {
                         // this will work but in xml doesn't
                        this.byId("col2").setHeaderSpan([2,1]);


                      
                        );

Would be nice if anybody could help.

Regards

Alex

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 08, 2016 at 12:51 PM

    Hello all,

    i debugged it now into the UI5 code. And seems the value in the XML is passed as string.

    in 1.28.28 SAPUI5

    in /sap/ui/table.js

    function Table.prototype._updateColumnHeader

    at line 2242ff i can see that the is an jQuery.isArray(vHeaderSpan) which will fail as vHeaderSpan is

    " '[2,1]' "

    So this statement will from XML always return false.

    Can i get a fix? Is there a good way to extend the control?

    Best regards

    Alex

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 24, 2016 at 06:26 AM

    Hi Alex,

    You can bind headerSpan property to a JSON model

    <tb:Column headerSpan="{path:'multiHeaderConfig>/multiheader3'}">
    
    
    var oMultiHeaderConfig = {
                    multiheader1:[3,1],
                    multiheader2:[4,1],
                    multiheader3:[6,1]
                };
    this.getView().setModel(new sap.ui.model.json.JSONModel(oMultiHeaderConfig), 'multiHeaderConfig');
    

    Regards,

    Dorian

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.