PDA

View Full Version : How to align form controls in non-editable grid?



bungrudi
18 Jan 2012, 7:53 PM
Hello,

Basically I have a non-editable grid (a TreeGrid instead of EditorTreeGrid), and in one column I'm rendering form widgets using GridCellRenderer, something like this (simplified a lot):

new GridCellRenderer<FinancialInfoTreeModel>() {
@Override

public Object render(FinancialInfoTreeModel treeModel, String property, ColumnData config, int rowIndex, int colIndex, ListStore<FinancialInfoTreeModel> baseTreeModelListStore, Grid<FinancialInfoTreeModel> baseTreeModelGrid) {
SimpleComboBox cb = new SimpleComboBox();
// some logic goes here to populate selection and regulate what happens on cb.onChange
return cb;
}
}

The problem is that the rendered combo boxes are aligned left.
I tried using columnConfig.setAlignment(Style.HorizontalAlignment.RIGHT) to no effect.
Thus the question, how do I right-align form controls in a non editable grid?

Many thanks.

Ersmarker
18 Jan 2012, 11:42 PM
You can set style attribute float: right on the combobox



SimpleComboBox cb = new SimpleComboBox();
cb.setStyleAttribute("float", "right");