cancel
Showing results for 
Search instead for 
Did you mean: 

How to get current Cell's Row & Col in a Dynamic Table??

Former Member
0 Kudos

Hi all,

I would to know if is possible, when I pass with a mouse over a specific cell's table (the table is created dynamically), to get the currents Row & Column.

My target is to set a tooltip for any cell of that table that says to user the label of Row & Column.

Can anyone help me please???

Thanks a lot.

Gianluca Barile

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Answered.

Former Member
0 Kudos

Yes that is possible, if the cell editor of that column has a tooltip property.

For each column <Column>, create a calculated attribute TooltipFor<Column> (type=string) under the data source node <Node> and implement the get-method like

String getTooltipFor<Column>(I<Node>Element element)
{
  return "<Column>-" + element.index();
}

Bind the <i>tooltip</i> property of each column to the corresponding attribute.

For example, if you have columns "A" and "B", you will get tooltips like "A-0", "A-1", "B-0", "B-1" etc.

Armin

Former Member
0 Kudos

Scuse me Armin,

I don't find the method (in Java code) for creating a Column's calculated attribute.

My Node and My Table are not visible in Context tabstrip, because I'd created them into wdDoModify() method.

My Node has (3 + N) attributes (columns) and it's binded to a Table.

I post you my code so I wish you explain me how I do Insert the lines code. Sorry but I don't had understanded the phases. Can you Help me please?? Thanks a lot.

if (firstTime) {		
		//Node
		IWDNodeInfo nodeinfo = wdContext.getNodeInfo();
		IWDNodeInfo grigliaComparativaNode = nodeinfo.addChild("NODE",null,true,true,true,false,false,true,null,null,null);
		//Aattributes
		IWDAttributeInfo nominativo = grigliaComparativaNode.addAttribute("Name","com.sap.dictionary.string");
		IWDAttributeInfo periodoDa = grigliaComparativaNode.addAttribute("From","com.sap.dictionary.string");
		IWDAttributeInfo periodoA = grigliaComparativaNode.addAttribute("To","com.sap.dictionary.string");
		IWDAttributeInfo[] voti = new IWDAttributeInfo[MAX_ELEMENTS];
		for (int i = 0; i < wdContext.nodeElements().size(); i++)
			voti<i> =	grigliaComparativaNode.addAttribute("V"+i,"com.sap.dictionary.string");		
//Table
		IWDTable tab=(IWDTable)view.createElement(IWDTable.class,"Dyntable");
		IWDAttributeInfo attrib1 = grigliaComparativaNode.getAttribute("Name");
		IWDAttributeInfo attrib2 = grigliaComparativaNode.getAttribute("From");
		IWDAttributeInfo attrib3 = grigliaComparativaNode.getAttribute("To");
		for (int i = 0; i < wdContext.nodeElements().size(); i++)
			voti<i> = grigliaComparativaNode.getAttribute("V"+i);
		//Binding Node -> Table
		tab.bindDataSource(grigliaComparativaNode);
		tab.setReadOnly(true);
		tab.setDesign(WDTableDesign.ALTERNATING);
		//Table’s Columns
		IWDTableColumn tabColumn1 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"Name");
		IWDTableColumn tabColumn2 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"From");
		IWDTableColumn tabColumn3 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"To");
		IWDTableColumn[] votiCol = new IWDTableColumn[MAX_ELEMENTS];
		for (int i = 0; i < wdContext.nodeElements().size(); i++)
			votiCol<i> = (IWDTableColumn)view.createElement(IWDTableColumn.class,"V"+i);
		//Captions
		IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"Name Caption");
		nameCap.setText("NAME");
		tabColumn1.setHeader((IWDCaption)nameCap);
		IWDCaption daCap=(IWDCaption)view.createElement(IWDCaption.class,"From Caption");
		daCap.setText("FROM");
		tabColumn2.setHeader((IWDCaption)daCap);
		IWDCaption aCap=(IWDCaption)view.createElement(IWDCaption.class,"To Caption");
		aCap.setText("TO");
		tabColumn3.setHeader((IWDCaption)aCap);
		IWDCaption[] votiCap = new IWDCaption[MAX_ELEMENTS];
		for (int i = 0; i < wdContext.nodeElements().size(); i++){
			votiCap<i> = (IWDCaption)view.createElement(IWDCaption.class,"V_C"+i);
			String s = wdContext.nodeElements().getElementAt(i).getAttributeAsText("Name");
			votiCap<i>.setText(s);
			votiCol<i>.setHeader((IWDCaption)votiCap<i>);
		}
		//Cells
		IWDInputField nameText=(IWDInputField)view.createElement(IWDInputField.class,"Name");
		nameText.bindValue(attrib1);
		tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
		IWDInputField daText=(IWDInputField)view.createElement(IWDInputField.class,"From");
		daText.bindValue(attrib2);
		tabColumn2.setTableCellEditor((IWDTableCellEditor)daText);
		IWDInputField aText=(IWDInputField)view.createElement(IWDInputField.class,"To");
		aText.bindValue(attrib3);
		tabColumn3.setTableCellEditor((IWDTableCellEditor)aText);
		IWDInputField[] votiField = new IWDInputField[MAX_ELEMENTS];
		for (int i = 0; i < wdContext.nodeElements().size(); i++){
			votiField<i> =(IWDInputField)view.createElement(IWDInputField.class,"V_F"+i);
			votiField<i>.bindValue(voti<i>);
			votiCol<i>.setTableCellEditor((IWDTableCellEditor)votiField<i>);
		}
		//Insert columns into table
		tab.addColumn(tabColumn1);
		tab.addColumn(tabColumn2);
		tab.addColumn(tabColumn3);
		for (int i = 0; i < wdContext.nodeElements().size(); i++){
		    tab.addColumn(votiCol<i>);
		}
		tab.createLayoutData(IWDRowHeadData.class);
}


Former Member
0 Kudos

Why do you implement all this by code instead of using the IDE? You should create all static parts at designtime if possible.

Armin