cancel
Showing results for 
Search instead for 
Did you mean: 

Table column header with submenu not working

0 Kudos
373

This is my code for my table columns.

So far only the "Formatter" is shown, but the submenu items not, whats wrong??

also, the filter and sort property get overwritten by the new menu. can i avoid this?

oTable.bindColumns("/columns", function(index, context) {
	var columnName = context.getObject().columnId;
	return new sap.ui.table.Column({
	        label:columnName,
		template: columnName,
		filterProperty: columnName,						sortProperty: columnName,
		menu: new sap.ui.unified.Menu({
			items: [
			new sap.ui.unified.MenuItem({
			text: "Formatter",
			items: [
				new sap.ui.unified.MenuItem({
				text: "#,##0",
				select: function(oEvent) {
							.. not relevant code}
				}),
				new sap.ui.unified.MenuItem({
					text: "#,##0.00",
					select: function(oEvent){
						.. not relevant code	}
				}),
				new sap.ui.unified.MenuItem({
					text: "###0",
					select: function(oEvent){
					.. not releavnt code}
				}),
			],
			})
							
			]
		}),
	})
})

Accepted Solutions (0)

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor
0 Kudos

HI Sonja,

Like I've mentioned in your previous question, menu is not supposed to be used in common requirements as it comes with some setbacks and one of it is when you use the menu aggregation, it replaces the actual columnmenu aggregation with the menu that you are passing.

Standard Github menu code below.... you can see it will check for aggregation and if it is there it will create menu with the aggregation you have passed and if not passed it will createmenu using columnmenu control




Column.prototype.getMenu = function() {		

var oMenu = this.getAggregation("menu");		

if (!oMenu) {			

oMenu = this._createMenu();			

this.setMenu(oMenu);		

}		

return oMenu;	};

You can still go ahead and extend the columnmenu control(in which u can have standard menu options and urs as well) and use it as the aggregation, which i believe will be a complex solution. I am also not sure how it will behave once you extend the column menu and set it to the column(filter, sort integration with ui.table).

Simple way(Considering it as a config.)-> like I've mentioned in your previous question give it as the configuration for the fiori app.

Best Regards,

Mahesh

SergioG_TX
Active Contributor
0 Kudos

are you getting an error on the console? press F12.. see the errors - there is not enough information here to guide you w an answer