1006181 Speed-up windows - Field to show read-only grid. Fixed sorting. (IDEMPIERE-3269)
This commit is contained in:
parent
fda19e207d
commit
7b0ce20cb8
|
@ -237,6 +237,7 @@ public class GridTabSelectionListView extends Borderlayout
|
||||||
ListHeader colHeader = new ListHeader();
|
ListHeader colHeader = new ListHeader();
|
||||||
colHeader.setSort("auto");
|
colHeader.setSort("auto");
|
||||||
colHeader.setLabel(gridField[i].getHeader());
|
colHeader.setLabel(gridField[i].getHeader());
|
||||||
|
colHeader.setAttribute("ColumnIndex", getColumnIndex(gridField[i].getColumnName()));
|
||||||
if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null) {
|
if (columnWidthMap != null && columnWidthMap.get(gridField[i].getAD_Field_ID()) != null) {
|
||||||
colHeader.setWidth(columnWidthMap.get(gridField[i].getAD_Field_ID()));
|
colHeader.setWidth(columnWidthMap.get(gridField[i].getAD_Field_ID()));
|
||||||
} else {
|
} else {
|
||||||
|
@ -256,6 +257,15 @@ public class GridTabSelectionListView extends Borderlayout
|
||||||
listbox.appendChild(header);
|
listbox.appendChild(header);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getColumnIndex(String columnName) {
|
||||||
|
for(int i = 0; i < gridTab.getTableModel().getColumnCount(); i++) {
|
||||||
|
if (gridTab.getTableModel().getColumnName(i).equals(columnName)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
private void render()
|
private void render()
|
||||||
{
|
{
|
||||||
listbox.setStyle("min-height: 200px");
|
listbox.setStyle("min-height: 200px");
|
||||||
|
|
|
@ -113,7 +113,11 @@ public class SimpleGridTableListModel extends AbstractListModel<GridTableRow> im
|
||||||
//use default zk comparator
|
//use default zk comparator
|
||||||
if (cmpr instanceof ListitemComparator) {
|
if (cmpr instanceof ListitemComparator) {
|
||||||
ListitemComparator lic = (ListitemComparator) cmpr;
|
ListitemComparator lic = (ListitemComparator) cmpr;
|
||||||
tableModel.sort(lic.getListheader().getColumnIndex(), ascending);
|
Integer index = (Integer) lic.getListheader().getAttribute("ColumnIndex");
|
||||||
|
if (index != null && index.intValue() >= 0)
|
||||||
|
tableModel.sort(index.intValue(), ascending);
|
||||||
|
else
|
||||||
|
tableModel.sort(lic.getListheader().getColumnIndex(), ascending);
|
||||||
} else if (cmpr instanceof SortComparator) {
|
} else if (cmpr instanceof SortComparator) {
|
||||||
SortComparator sc = (SortComparator)cmpr;
|
SortComparator sc = (SortComparator)cmpr;
|
||||||
tableModel.sort(sc.getColumnIndex(), ascending);
|
tableModel.sort(sc.getColumnIndex(), ascending);
|
||||||
|
|
Loading…
Reference in New Issue