Threaded View

  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    3
    Vote Rating
    0
    y.mochizuki is on a distinguished road

      0  

    Default Answered: Grid rowNumberer Issue number of digits

    Answered: Grid rowNumberer Issue number of digits


    Hello,
    I want to give the line number in the grid.
    I tried to display line numbers in the grid using the RowNumber.
    However, the number of displayed digits is omitted when it is 4 or more digits when using the RowNumber.
    So, I set the width of the RowNumber.
    But then, header width will be expanded, the width of the line is not expanding, however.

    Code:
    List<ColumnConfig<?, ?>> colList  = new ArrayList<ColumnConfig<?, ?>>();
    RowNumberer<Stock> rowNumberer = new RowNumberer<Stock>(new IdentityValueProvider<Stock>());
    rowNumberer.setWidth(30);
    colList.add(rowNumberer);
    colList.add(new ColumnConfig<Stock, String>(props.name(), 200, "names"));
    ColumnModel cm = new ColumnModel(colList);
    I chose how to get the Element for each row of the grid ViewReadyHandler So, to set the style.
    Code:
    ViewReadyHandler vrh = new ViewReadyHandler() {
        @Override
        public void onViewReady(ViewReadyEvent event) {
            for(int i=0;i<grid.getStore().size();i++){
                Element rowHeaderElement = grid.getView().getRow(i).getFirstChildElement();
                if(rowHeaderElement != null){
                    rowHeaderElement.setAttribute("style", "background-size:30px");
                }
            }
        }
    };
    This method will return to their original style and make cell click event, and store data but update.
    Is there any good solutions?

  2. Main issue seems to be the background-position of the background needs to be set to 'right' - try adding something like this to a css file:

    Code:
    .x-grid-td-numberer {
        background-position: RIGHT 0 !important;
    }
    This is a workaround, not a real fix - I'll investigate this further, and possible file a bug for this. This fix is very brittle and may break in future versions of GXT, as it is depending on inconsistent use of the appearance pattern within the Grid.

Thread Participants: 1