1. #1
    Ext User
    Join Date
    Jul 2009
    Posts
    20
    Vote Rating
    0
    jazzer is on a distinguished road

      0  

    Default Rendering checkbox in treegrid

    Rendering checkbox in treegrid


    Two questions: 1) I'm trying to figure out how to use a renderer for a checkbox in a treegrid. I want to hide the checkbox at the parent levels. I'm trying this but it doesn't work - the check box renders in one of the children but not the others.

    Is there a better way to do this?

    CheckColumnConfig checkColumn = new CheckColumnConfig(template.isAutoLogOn.toString(), "AUTOLOG?", 60);
    final CheckBox cb = new CheckBox();
    checkColumn.setRenderer(new GridCellRenderer<ModelData>(){
    @Override public Object render(ModelData model, String property,
    ColumnData config, int rowIndex, int colIndex,
    ListStore<ModelData> store, Grid<ModelData> grid) {

    if (model.get("type").equals("resource")) {
    cb.setVisible(false);
    return cb;
    }
    else {
    cb.setVisible(true);
    return cb;
    }
    }
    });
    CellEditor checkBoxEditor = new CellEditor(cb);
    checkColumn.setEditor(checkBoxEditor);
    columns.add(checkColumn);

    Question 2) Is there a good example of how to render fields in the parent row based on data in the child rows? If the user updates a child row, I want to update the parent without having to round trip data to the server.

    Thanks!

  2. #2
    Sencha User
    Join Date
    Feb 2008
    Posts
    47
    Vote Rating
    0
    gald is on a distinguished road

      0  

    Default


    i thing i did something similar to your question 1.
    first i make a class to overrhide CheckColumnConfig.onRender

    Code:
    public class myCheckColumnConfig extends CheckColumnConfig
    {
    
       public myCheckColumnConfig (String id, String name, int width)
       {
          super(id, name, width);
       }
    
       protected String onRender(ModelData model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store)
       {
          if (model instanceof myModel)
          {
             config.css = "x-grid3-check-col-td";
             return "<div class='x-grid3-check-col" + " x-grid3-check-col" + getCheckState(model, property, rowIndex, colIndex) + " x-grid3-cc-"
                   + getId() + "'>&#160;</div>";
          }
          return "";
       }
    }
    and then i use id in my column config

    Code:
          ColumnConfig cc= new myCheckColumnConfig("toto", "Toto", 75);
          CellEditor checkBoxEditor = new CellEditor(new CheckBox());
          cc.setEditor(checkBoxEditor);
          cc.add(cc);

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