cancel
Showing results for 
Search instead for 
Did you mean: 

How to create columns of table dynamically depends on selected dates

nandishm
Participant
0 Kudos

Hi..

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

    Ex:-

       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 .

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

maximilian_lenkeit
Participant
0 Kudos

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