+1-757-461-3022 x124

Changing Existing Column Names

When creating columns in a window, it is possible to change these names as needed.he following code is what determines the column titles in a screen:

var _list = mywindow.list(); // (or however youre getting a handle on the xtreewidget)
var _header = _list.headerItem();
_header.setText("column_name", "New Text");

The string labeled "column_name" lets you assign the default name to new columns as they're added. The "New Text" string is where header text can be added or changed. The dspTimePhasedOpenARItems script allows additions of columns in xTuple tables. 

The docs for the XTreeWidget show that the headerItem() method returns a QTreeWidgetItem. The same page also shows that the column() method returns an integer value for a given column name. Following the documentation link for QTreeWidgetItem and looking for setText(), we see one way to set the header text of a column -- use its integer index.

Put those three things together and we get this:

var lst = mywindow.list(),
hdr = lst.headerItem(),
idx = lst.column('araging_cur_val_sum');
hdr.setText(idx, 'Current');

This index sets the header text for the columns in a table.

up
17 users have voted.