Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Finding column for Tablesorter

<body><p>Hi,</p><p></p><p>After implementing &#91;table sorter|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3287&#93 <b>[original link is broken]</b> <b>[original link is broken]</b> <b>[original link is broken]</b>; is there any way I can find which column has been clicked for sorting?</p></body>
Former Member replied

Hi,

You will be able to find this from the following method

public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {
		// find the things we need
		String columnId = wdEvent.getString("selectedColumn");
		String direction = wdEvent.getString("sortDirection");
		IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);
		NodeElementByAttributeComparator elementComparator = (NodeElementByAttributeComparator) comparatorForColumn.get(column);
		
		if (elementComparator == null){
			//not a sortable column
			column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
			return; 
		}
		
		// sorting
		elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));
		dataSource.sortElements(elementComparator);
	}

Regards

Ayyapparaj

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question