Skip to Content

Create a Table dynamically

Hi Experts,

I have a requirement where I have to create dynamic tabs with table when I hit the service ill get the different types.

For example: I have a service which has multiple types (let say type1 , type2).how many types that I have in service that many icontabFilters i need to create withe respect to table.

I'm getting binding issue for table. Please can any one help me on this.

IconTab--> Main

IcontabFilter1 IcontabFilter2

Table1 table2

Code:

var data = {"TABLES":{}};

for(var i in charctersticTable.getItems()){

var oDynamicTable = new sap.m.Table({

columns:[

new sap.m.Column({

header:[new sap.m.Label({text:"Characteristics"}),

]

})

]

});

var oColumnListItem = new sap.m.ColumnListItem({

cells:[

new sap.m.Label({text:"{CharacteristicsModel>ATBEZ}"})

]

});

var tabl = charctersticTable.getItems()[i]

tabl.addContent(oDynamicTable);

var oGrnam = charctersticTable.getItems()[i].getProperty('text');

var contextFilter = new sap.ui.model.Filter([new sap.ui.model.Filter("GRNAM", sap.ui.model.FilterOperator.EQ,oGrnam),

new sap.ui.model.Filter("CLASS", sap.ui.model.FilterOperator.EQ,"BATCH_CLASS")],true)

var characteristics = [] // which is array it has multiple objects

var oModelChar = this.getView().getModel("CharacteristicsModel");

if(oModelChar !== undefined){

// oModelChar.getData().TABLES[oGrnam]=[];

// for(var i in characteristics){

// oModelChar.getData().TABLES[oGrnam].push(characteristics[i]);

// }

// oModelChar.refresh();

}else{

data.TABLES[oGrnam]= characteristics;

var oModel = new sap.ui.model.json.JSONModel(data);

this.getView().setModel(oModel, "CharacteristicsModel");

}

oDynamicTable.bindItems("CharacteristicsModel>/TABLES/"+oGrnam,oColumnListItem);

}

Thanks,

Ashok.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 14, 2016 at 09:27 AM
    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.