cancel
Showing results for 
Search instead for 
Did you mean: 

How to get column header text in IWDTable

Former Member
0 Kudos

Hi

Just want to know how to get column header name in IWDTable.

I know that you can get it with


IWDAbstractTableColumn[] groupedColumns = table.getGroupedColumns();
for (int i = 0; i < groupedColumns.length; i++) {
	IWDAbstractTableColumn column = groupedColumns<i>;
	column.getHeader().getText();
					
}

But what if text isnt set on header level but its rendered from cellEditor model binding (im not sure if its like that).

Accepted Solutions (0)

Answers (1)

Answers (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

You can change the column headers even you bind with model node.

Regards

Abhimanyu L

Former Member
0 Kudos

Yes i know but i just want to create view which can display columns name list. I'm doing some kind of personalization of tables, where you can hide or display column or change column order. Solution must be flexible so data must be read dynamically.

abhimanyu_lagishetti7
Active Contributor
0 Kudos

Hi

You can use your code or

U can get from the context attribute.

IWDAttributeInfo info = wdContext.node<node>.getNodeInfo().getAttribute('attribute name');

String str = info.getSimpleType().getDescription();

Regards

Abhimanyu L

Former Member
0 Kudos

Finally after your suggestion i did it with this code


String header = column.getHeader().getText();
			    if ((header == null || header.length() == 0) && column instanceof IWDTableColumn){
			    	IWDTableCellEditor tableCellEditor = ((IWDTableColumn) column).getTableCellEditor();
			    	if (tableCellEditor instanceof IWDTextView){
			    		String bindingPath = ((IWDTextView)tableCellEditor).bindingOfText();
						StringTokenizer tokenizer = new StringTokenizer(bindingPath,".");
						String token = "";
						IWDNodeInfo nodeInfo = context.getNodeInfo();
						while (tokenizer.hasMoreTokens()){
							token = tokenizer.nextToken();
							if (tokenizer.hasMoreTokens()){
								nodeInfo = nodeInfo.getChild(token);		
							}
						}
						IWDAttributeInfo attribute = nodeInfo.getAttribute(token);
						ISimpleType simpleType = attribute.getSimpleType();
						simpleType.getDescription();
			    		header = simpleType.getDescription();
			    	}
			    }