1. #1
    Ext User
    Join Date
    Feb 2009
    Posts
    22
    Vote Rating
    0
    JensHeyer is on a distinguished road

      0  

    Default grid column auto width via TextMetrics

    grid column auto width via TextMetrics


    Hello everybody,

    I need some help concerning the TextMetrics class. What I want to do is just to auto resize the width of a grid column when adding a new row. This is what I've done so far, but somehow the width is not the size as expected:

    Code:
            grid.getView().addListener(Events.RowUpdated, new Listener<GridEvent<Instrument>>() {
                @Override
                public void handleEvent(GridEvent<Instrument> be) {
                    Instrument instrument = store.getAt(be.getRowIndex());
    
                    TextMetrics metrics = TextMetrics.get();
    
                    Element bidElement = (Element) grid.getView().getCell(be.getRowIndex(), 5);
                    metrics.bind(bidElement);
                    Integer x1 = metrics.getWidth(String.valueOf(instrument.getBid()));
                    
                    Element askElement = (Element) grid.getView().getCell(be.getRowIndex(), 6);
                    metrics.bind(askElement);
                    Integer x2 = metrics.getWidth(String.valueOf(instrument.getAsk()));
                    
                    Element timeElement = (Element) grid.getView().getCell(be.getRowIndex(), 7);
                    metrics.bind(timeElement);
                    Integer x3 = metrics.getWidth(instrument.getTime().toString());
                    
                    System.out.println(x1 + ", " + x2 + ", " + x3);
                    
                    grid.getColumnModel().getColumnById("bid").setWidth(x1);
                    grid.getColumnModel().getColumnById("ask").setWidth(x2);
                    grid.getColumnModel().getColumnById("time").setWidth(x3);
                    grid.getView().refresh(true);
                }
            });

  2. #2
    Ext User
    Join Date
    Feb 2009
    Posts
    22
    Vote Rating
    0
    JensHeyer is on a distinguished road

      0  

    Default


    Is there anybody who can tell me how to use TextMetrics in proper form?

  3. #3
    Sencha User
    Join Date
    Apr 2010
    Posts
    18
    Vote Rating
    0
    vbjain is on a distinguished road

      0  

    Default


    Do you got solution for this? I am having same requirement. It will be great help if you let me know how you achieved it?

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi