1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    listirer is on a distinguished road

      0  

    Post Update all rows into a EditorGrid

    Update all rows into a EditorGrid


    I use an EditorGrid with a combo as column.
    Code:
    final SimpleComboBox<MyValue> comboBox = new SimpleComboBox<MyValue>();
    comboBox.setEditable(false);
    comboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
    comboBox.add(MyValue.getAll());
    CellEditor comboEditor = new CellEditor(comboBox) {
    
        @Override
        public Object preProcessValue(Object value) {
            if (value == null) {
                return value;
            }
            return comboBox.findModel((MyValue) value);
        }
    
        @Override
        public Object postProcessValue(Object value) {
            if (value == null) {
                return value;
            }
            return ((SimpleComboValue<MyValue>) value).getValue();
        }
    };
    GridCellRenderer<MyObject> renderer = new GridCellRenderer<MyObject>() {
    
        @Override
        public Object render(MyObject model, String property,
                             ColumnData config, int rowIndex, int colIndex,
                             ListStore<MyObject> store,
                             Grid<MyObject> grid) {
            MyValue value = model.getValue();
            return "<span style='color:" + value.toString()
                    + "'>" + value + "</span>";
        }
    };
    ColumnConfig column = new ColumnConfig();
    column.setId("value");
    column.setHeader("Value");
    column.setWidth(150);
    column.setFixed(true);
    column.setEditor(comboEditor);
    column.setRenderer(renderer);
    I would update a property for all objects into the store, and so view the change into my grid, ie into the combo for each rows.
    Code:
    store.setKeyProvider(new ModelKeyProvider<MyObject>() {
    
        @Override
        public String getKey(MyObject model) {
            return model.getId();
        }
    });
    
    ...
    
    for(String id : IDS){
        store.findModel(id).setValue(DEFAULT_VALUE);
    }
    How do I?
    Last edited by listirer; 17 Feb 2012 at 11:23 AM. Reason: KeyProvider code

  2. #2
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    listirer is on a distinguished road

      0  

    Default


    A workaround for that is:
    Code:
    for(String id : IDS){
        store.findModel(id).setValue(DEFAULT_VALUE);
    }
    grid.getView().refresh(false);
    But for all the cells of the column don't will be market with triangle in upper-left that indicate the changing.

    Can I do it better...

  3. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    listirer is on a distinguished road

      0  

    Default


    I discovered the Record object useful for my purpose.
    This is the code:
    Code:
    for(String id : IDS){
        MyObject obj = store.findModel(id);
        Record r = store.getRecord(obj);
        r.set("value",DEFAULT_VALUE);
    }

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Location
    Leipzig, Germany
    Posts
    75
    Vote Rating
    1
    A.Rothe is on a distinguished road

      0  

    Default


    I think you can simply call store.update(model) to generate an event, which refreshes the model representation within the grid.

    ~Andre

  5. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    19
    Vote Rating
    0
    listirer is on a distinguished road

      0  

    Default


    With this previous post I fix 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