Skip to Content

How to create columns of table dynamically depends on selected dates


     I am just started to learn UI5, i wanted to create table where its columns depends on use selection.


       I have two option in screen From Date and To Date

       if user selects From :- 10/01    To:- 20/01

      Then   my table must contain following columns

10/01            11/01              12/01             13/01             14/01            15/01            16/01            17/01             18/01                19/01                20/01

Is there any way to do it. If user selects another Dates then it must display another dates .

I am using XML file for view and JavaScript file for controller .


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Jan 06, 2015 at 11:06 AM

    First of all, note that the columns are just a regular aggregation like any other (e.g. the rows or items aggregation).

    There are two options I can think of:

    a) Programmatically: Destroy the columns aggregation (see destroyColumns in the API doc) and then manually adding columns via addColumn based on the date range that you have.

    b) Model-driven: as the columns a regular aggregation, you can bind them to a model. You would then need to populate the model based on the date range and then, the columns update accordingly.See the documentation on aggregations for details: SAPUI5 SDK - Demo Kit

    Personally, I would prefer option b. You can play around with those approaches. Make sure to include a code sample (e.g. JSBin) if you get stuck anywhere along the way.

    - Max

    Add comment
    10|10000 characters needed characters exceeded