Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid doesn't want to set the width of the delete-button column

    Some informations :
    • SmartClient Version: v8.2p_2012-05-23/LGPL Development Only (built 2012-05-23)
    • Google Chrome Version 23.0.1271.95 m
    • GWT 2.4.0
    • Eclipse Version: Indigo Service Release 2, Build id: 20120216-1857
    • SmartGWT 3.1


    On a ListGrid, when you enable to remove a record there is a cross image stand on each record line.
    Is it possible de resize this column ?

    Code:
        for (ListGridField field : listGrid.getFields()) {
          System.out.println("'" + field.getName() + "'");
        }
    When I ask for the list of fields of listGrid it give me a list of column name then a column whose name is "$54h"... I think it is the name for the delete button column.

    But it seems that this code :

    Code:
        for (ListGridField field : listGrid.getFields()) {
          field.setWidth("100%");
        }
        listGrid.getField("$54h").setWidth(60);
    does not produce what I want : means my delete-button column is not 60px width.

    Does anyone understand why ?

    This is what I get have :


    More source code :

    Code:
        listGrid = new ListGrid();
        listGrid.setCanRemoveRecords(false);
        listGrid.setCanEdit(false);
        listGrid.setAutoFitFieldsFillViewport(true);
        listGrid.setAutoFitFieldWidths(true);
        listGrid.setWidth100();
        listGrid.setHeight100();
        listGrid.setShowAllRecords(true);
        listGrid.setAlternateRecordStyles(true);
        listGrid.setEditEvent(ListGridEditEvent.CLICK);
        listGrid.setShowRecordComponents(true);
        listGrid.setShowRecordComponentsByCell(true);
        listGrid.setShowHeaderContextMenu(false);
        listGrid.setShowHeaderMenuButton(false);
    
        setFieldsWidth();
    Code:
      private void setFieldsWidth() {
        for (ListGridField field : listGrid.getFields()) {
          field.setWidth("100%");
        }
    
        int column_width = 60;
        setFieldWidth("COL_NAME1", column_width);
        setFieldWidth("COL_NAME2", column_width);
        setFieldWidth("COL_NAME3", column_width);
        setFieldWidth("COL_NAME4", column_width);
        setFieldWidth("COL_NAME5", column_width);
        // Taille de la colonne contenant le bouton de suppression
        setFieldWidth("$54h", 60);
      }
    
      private void setFieldWidth(String name, int width) {
        if (null != listGrid.getField(name)) {
          listGrid.getField(name).setWidth(width);
        }
      }
    Last edited by lnplnp; 11 Dec 2012, 02:19.
Working...
X