Skip to Content
author's profile photo Former Member
Former Member

Creatins a table with dynamic number of columns.

Hi Experts,

I am creating a mobile timesheet app in which I have WON and dates {1,2,3,....31} as a column. Since the number of days in month is not constatnt I can't have always column for 31 days. Hence I want to find a way by which we can cretae table with dynamic column in which number of column will come from some variable/model data in initialization method of controller.

Since I am creating mobile application , I am using sap.m library. One more problem is I want sap.m.table to have scroll bar keeping first column fixed and others scrollable. I know that the fixed column functionality is supported by desktop table(sap.ui.table) but I want to know is there any way by which we can acheive this functionality.

Please help me with this.

Thank you,

Dhiraj More

Add a comment
10|10000 characters needed characters exceeded

Related questions

6 Answers

  • Best Answer
    Posted on Mar 25, 2015 at 05:48 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2015 at 07:14 AM

    Hey

    Thanks for your input. This is of great help but still I want to know if we can have some column fixed in our sap.m.table.

    Regards,

    Dhiraj More

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2015 at 10:07 AM

    Hi Maksim,

    Two more problems in above discussed requirement.

    1. To have last column TOTAL which will have sum of all the efforts for whole month.

    2. To have last row TOTAL which will have total efforts logged for different projects on daily basis(daywise).

    To make it more clear I am also specifying layout.

    Table Header:

    WON DESC SU/1 MO/2 TU/3 ....... MO/30 TU/31 TOTAL

    Table ROW

    123455 XYZ 8 4 3 5 6 [8+4+3+....+5+6]

    .... 4 2

    .....rows 3 1

    TOTAL [8+4+3] [4+2+1] .... likewise

    Thanks for your valuable help and time.

    Regards,

    Dhiraj More

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 27, 2015 at 09:29 AM

    Hi Maksim,


    It is very close to what I wanted. Thanks you very much for your prompt and immediate help.

    I appreciate the way you sharing your knowledge/expertise with others.


    I have one more small challenge for you. Please find my query on the below discussion title:


    How to get row index in which field change triggered an event.

    Thank You very much for your help.


    Regards,

    Dhiraj More

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 06:13 AM

    Hi Maksim,

    I have one more query I want that the column having SAT and SUN should be non editable and its value is to be hardcoded with 0.

    Could you please tell me how we can do it if we are passing the data from Model. Whenever we are giving name to column "SAT/1" and "SU/2" at that time I want to make it non-editable and hardcoded. I am using below syntax to define model.

    var oData = { columns : [ ],

    Data : [ {

    'WON' : "1234569",

    'DESC' : "Toronto",

    '1E' : "9",

    '2E' : "8",

    '3E' : "7",...................................}];

    I am doing like this because data is going to come from model(ODATA Model). For the time being I am providing JSon data.

    I know if I define data the way you did it can be more easy. But my requirement is to fetch data from model.

    var ={columns:[],

    data:[] //This way it is easy.

    };

    Thank You.

    Dhiraj More

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 30, 2015 at 07:26 AM

    Hi Maksim,

    I forgot to tell you that I am using XML view. I was expecting the same in javascript but i want to know if something like this we can do it in XML while defining <column List ITem tag or IPUT tag>.

    <items>

    <ColumnListItem>

    <Input type="Text" value ="{WON}" editable= "true" />

    <Input type="Text" value ="{DESC}" editable= "true" />

    <Input type="Text" value ="{1E}" editable= "true" liveChange="updateTotal" />

    <Input type="Text" value ="{2E}" editable= "true" liveChange="updateTotal" />

    <Input type="Text" value ="{total}" editable= "false" />

    </ColumnListItem>

    </items>

    Thank You for your immmediate help....

    Regards,

    Dhiraj More

    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.