Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Posts
    52
    Vote Rating
    0
    BayerBusiness is on a distinguished road

      0  

    Question [FNR] RowEditor changes read only field after Cancel + another RowEditor problem

    [FNR] RowEditor changes read only field after Cancel + another RowEditor problem


    Actually, I was trying to track another issue, but building the testcase I found this one:
    - You have an EditorGrid with a read only column (no CellEditor) and an editable column (with CellEditor)
    - You are using the RowEditor plugin

    - Click on the first line to show the RowEditor
    - Cancel editing
    - Click on the second line

    Surprisingly, the read only value of the first column in the first line gets changed to the value of the second line (and the red triangle is shown).

    Testcase:
    Code:
    import java.util.ArrayList;
    
    import com.extjs.gxt.ui.client.data.BaseModelData;
    import com.extjs.gxt.ui.client.data.ModelData;
    import com.extjs.gxt.ui.client.event.ButtonEvent;
    import com.extjs.gxt.ui.client.event.SelectionListener;
    import com.extjs.gxt.ui.client.store.ListStore;
    import com.extjs.gxt.ui.client.widget.ContentPanel;
    import com.extjs.gxt.ui.client.widget.Viewport;
    import com.extjs.gxt.ui.client.widget.button.Button;
    import com.extjs.gxt.ui.client.widget.form.TextField;
    import com.extjs.gxt.ui.client.widget.grid.CellEditor;
    import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
    import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
    import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
    import com.extjs.gxt.ui.client.widget.grid.RowEditor;
    import com.extjs.gxt.ui.client.widget.layout.FitLayout;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class Testcase implements EntryPoint {
        
        private EditorGrid<ModelData> grid = null;
                    
        public void onModuleLoad() {
            ArrayList<ColumnConfig> columnConfigs = new ArrayList<ColumnConfig>();
            
            ColumnConfig columnConfig = new ColumnConfig("noeditor", "No Editor", 100);
            columnConfig.setSortable(false);
            columnConfigs.add(columnConfig);
            
            columnConfig = new ColumnConfig("editor", "Editor", 200);
            columnConfig.setSortable(false);
            columnConfig.setEditor(new CellEditor(new TextField<String>()));
            columnConfigs.add(columnConfig);
                    
            ColumnModel columnModel = new ColumnModel(columnConfigs);
            
            ListStore<ModelData> store = new ListStore<ModelData>();
            grid = new EditorGrid<ModelData>(store, columnModel);
            
            grid.addPlugin(new RowEditor<ModelData>());
            
            ModelData model = null;
            
            model = new BaseModelData();
            model.set("noeditor", "Example11");
            model.set("editor", "Example12");
            store.add(model);
            
            model = new BaseModelData();
            model.set("noeditor", "Example21");
            model.set("editor", "Example22");
            store.add(model);
            
            Button btnReset = new Button("Reset");
            btnReset.addSelectionListener(new SelectionListener<ButtonEvent>() {
                @Override
                public void componentSelected(ButtonEvent ce) {
                    grid.getStore().removeAll();
                    
                    ModelData model = null;
                    
                    model = new BaseModelData();
                    model.set("noeditor", "Example11");
                    model.set("editor", "Example12");
                    grid.getStore().add(model);
                    
                    model = new BaseModelData();
                    model.set("noeditor", "Example21");
                    model.set("editor", "Example22");
                    grid.getStore().add(model);
                }
            });
            
            ContentPanel panel = new ContentPanel();
            panel.setLayout(new FitLayout());
            panel.setHeading("Example");
            panel.add(grid);
            panel.addButton(btnReset);
            
            Viewport viewport = new Viewport();
            viewport.setLayout(new FitLayout());
            
            viewport.add(panel);
            
            RootPanel.get().add(viewport);
        }
    }
    Actually, I was trying to track another issue: I have a grid which looks almost like to the one of the testcase (but more columns and using CellEditor(ComboBox). On the first grid load, the RowEditor works fine. After grid.getStore().removeAll and loading data again, the RowEditor crashes in startEditing at this line:
    Code:
    Object val = cm.getEditor(i).preProcessValue(record.get(dIndex));
    I'm not able to track it exactly (the testcase contains a refresh button to test this - but it works [in the testcase...]).

    Could it be, that the code is crashing, as there is no check, if there is any CellEditor?




    Shouldn't startEditing contain the same check on "no field" or "LabelField" as stopEditing (code position may be wrong)?

    Regards,
    HerrB

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Shouldn't startEditing contain the same check on "no field" or "LabelField" as stopEditing (code position may be wrong)?
    No it should not, because than the fields wont be updated and that would be wrong (never showing any value).

    I cannot reproduce your problem against GXT 2.2.0 final. Can you test that out or make sure you are really using GXT 2.2 final?

    Also why do you use an EditorGrid together with the RowEditor?

  3. #3
    Ext GWT Premium Member
    Join Date
    Feb 2010
    Posts
    52
    Vote Rating
    0
    BayerBusiness is on a distinguished road

      0  

    Default


    >No it should not, because than the fields wont be updated
    Ok, then I will try to find the element that becomes null in my code for whatever reason ... ;-)

    Testcase shows the behaviour with
    - GXT 2.2.0 (download last week from Downloads)
    - GWT 2.0.2
    - IE6
    - Updated resource folder
    - Completely recompiled code

    Note, that you have to click into the first (non-editable) cell to get into the edit mode, cancel and click in the first or second cell of the second column (not important).

    Unfortunately, I can't post an image, sorry.

    >Also why do you use an EditorGrid together with the RowEditor?
    That is a good question, I thought, you'll need an EditorGrid to use the RowEditor plugin.

    I will change this in my code, the behaviour of the TestCase remains... ;-)

    Regards,
    HerrB

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I was able to reproduce it. The problem is that you are using an EditorGrid together with the RowEditor. The RowEditor adds editors for the non editable cells(LabelFields are added) and that interfer with the EditroGrid.

  5. #5
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I am going to change RowEditor to work together with EditorGrid.

  6. #6
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    As this change was tested by BayerBusiness and it is working for him without any modifications, this will be part of GXT 2.2.1. I will reply here one more time when this was commited.

  7. #7
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Fixed in SVN as of revision 2219

Similar Threads

  1. [CLOSED][3.0rc1.1] RowEditor not handling cancel
    By arnaldur in forum Ext 3.x: Bugs
    Replies: 9
    Last Post: 13 Nov 2009, 9:55 PM
  2. RowEditor do not cancel.
    By joao_candido in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 31 Jul 2009, 7:03 AM
  3. RowEditor custom cancel event?
    By markmacumber in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 14 Jul 2009, 2:33 PM

Thread Participants: 1