PDA

View Full Version : Hiding horizontal scroll bar in a grid



kschaller79
12 Oct 2011, 3:48 PM
Using GXT 2.1.0 - I have a grid where the user does not want to show the scroll bar but the columns must be resizable. I have tried using force fit and setting the scroll mode in the parent container but not getting anywhere. The view is on a GXT window and there are no widths/styles applied.

Anyone have any ideas?



List<ColumnConfig> configs =new ArrayList<ColumnConfig>();
LayoutContainer layoutContainer = new LayoutContainer();
layoutContainer.setLayout(new RowLayout(Orientation.VERTICAL));

ColumnConfig clmncnfgProduct = new ColumnConfig(PurchaseAddendumItemData.FIELD_PRODUCT, labels.product(), 70);



// clmncnfgProduct.setAlignment(HorizontalAlignment.LEFT);



configs.add(clmncnfgProduct);ColumnConfig clmncnfgDescription =



new ColumnConfig(PurchaseAddendumItemData.FIELD_DESCRIPTION, labels.description(), 125);



// clmncnfgDescription.setAlignment(HorizontalAlignment.LEFT);



configs.add(clmncnfgDescription);ColumnConfig clmncnfgQuantity =



new ColumnConfig(PurchaseAddendumItemData.FIELD_QUANTITY, labels.quantity(), 70);



// clmncnfgQuantity.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgQuantity);ColumnConfig clmncnfgUnit =



new ColumnConfig(PurchaseAddendumItemData.FIELD_UNIT, labels.unit(), 70);



// clmncnfgUnit.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgUnit);ColumnConfig clmncnfgEach =



new ColumnConfig(PurchaseAddendumItemData.FIELD_EACH, labels.each(), 50);



// clmncnfgEach.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgEach);clmncnfgEach.setRenderer(



new CurrencyGridCellRenderer());ColumnConfig clmncnfgTaxRate = new ColumnConfig(PurchaseAddendumItemData.FIELD_TAX_RATE, labels.taxRate(), 50);



// clmncnfgTaxRate.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgTaxRate);clmncnfgTaxRate.setRenderer(



new CurrencyGridCellRenderer());ColumnConfig clmncnfgTax = new ColumnConfig(PurchaseAddendumItemData.FIELD_TAX, labels.tax(), 50);



// clmncnfgTax.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgTax);clmncnfgTax.setRenderer(



new CurrencyGridCellRenderer());ColumnConfig clmncnfgDiscount = new ColumnConfig(PurchaseAddendumItemData.FIELD_DISCOUNT, labels.discount(), 50);



// clmncnfgDiscount.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgDiscount);clmncnfgDiscount.setRenderer(



new CurrencyGridCellRenderer());ColumnConfig clmncnfgExtension = new ColumnConfig(PurchaseAddendumItemData.FIELD_EXTENSION, labels.extension(),50);



// clmncnfgExtension.setAlignment(HorizontalAlignment.RIGHT);



configs.add(clmncnfgExtension);clmncnfgExtension.setRenderer(



new CurrencyGridCellRenderer());

itemGrid = new Grid<PurchaseAddendumItemData>(new ListStore<PurchaseAddendumItemData>(), new ColumnModel(configs));
itemGrid.setHeight(100);
itemGrid.getView().setForceFit(true);
itemGrid.setBorders(Boolean.FALSE);
layoutContainer.setScrollMode(Scroll.NONE);


layoutContainer.add(itemGrid);