cancel
Showing results for 
Search instead for 
Did you mean: 

sap.m.table utility function issue

Former Member
0 Kudos

Hi,

Can someone please help on the below issue where I am not able to bind the data to the table?

For the table utility function:

function createMTable(tableID, colList, queryPath){
	
	var RefreshDate = new Date();

	var oTable;	
	var oModel = new sap.ui.model.xml.XMLModel();
	
	oModel.loadData("/XMII/Illuminator?QueryTemplate="+queryPath+"&d="+RefreshDate+"&Content-Type=text/xml","",false);
	oModel.setSizeLimit(50000);
	
	if(sap.ui.getCore().byId(tableID) == null) {
		
		oTable = new sap.m.Table({
			id: tableID,
			width : "100%",
			columns: colList,

			items: {
				path: queryPath ,
				template: new sap.m.ColumnListItem()
			}
		});

	} else {
		oTable =  sap.ui.getCore().byId(tableID) ;
	}

	    oModel.setData({
       		 columns: colList,
       		 rows: "/Rowset/Row"
    		});

	oTable.setModel(oModel);
	oTable.invalidate();
	return oTable;
}


For the columns utility function : 

function createMColumn(colID, labelText, valueElement) {

	var oColumn = new sap.m.Column({
	header: new sap.m.Label({text: labelText})
/****here we don't have template option to bind the value element from query
like this:  
template: new sap.ui.commons.TextView().bindProperty("text", valueElement),
****/
how to define the template here?
	});
	return oColumn;
}

Thanks for your help,

Venkatesh

Accepted Solutions (0)

Answers (1)

Answers (1)

iftah_peretz
Active Contributor
0 Kudos

Hi,

I am unclear as of to your issue. You don't define a template in the sap.m.Column class.

You define the columns. In them, you define the ColumnListItem and in them a cell of type sap. ui.core .Control . In them, you can define a formatter, which is what you call a template. Please take a look at the samples and the documentation. If I have misunderstood you please narrow down the question to the most specific issue, so I can try and help you with.