Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    markmacumber is on a distinguished road

      0  

    Default [FIXED] Row Editor Bug when adding first record

    [FIXED] Row Editor Bug when adding first record


    - GXT version: 2.0
    - Host mode / web mode / both: BOTH
    - Browser and version: Firefox 3.0.10
    - Operating System: Ubuntu 8.04
    - Sample code: see below

    We have a simple grid with 2 columns, that contains no records, we copied most of the code from the example: http://extjs.com/examples-dev/explor...#roweditorgrid and we wired up a callback for the AfterEdit event that gets fired after the used clicks "Save".

    Code:
            Listener<RowEditorEvent> saveListener = new Listener<RowEditorEvent>() {
                public void handleEvent(RowEditorEvent ree) {
                      Record r = ree.getRecord();
                      //do our thing with the record...
                }
            };
    In the very first instance where we are adding a new record to the grid, we are getting a null pointer on the record from the RowEditorEvent, (i.e. ree.getRecord() returns null).
    We tracked down where it happens and believe it to be a bug.

    The issues comes down to the GridView class, insertRows method, line 1207:

    Code:
      protected void insertRows(ListStore<ModelData> store, int firstRow, int lastRow, boolean isUpdate) {
        if (isUpdate && firstRow == 0 && lastRow == store.getCount() - 1) {
          refresh(false);
          return;
        }
        ...
      }
    When you add the first record in the grid and click save, the refresh(false) method gets fired, but when you add any record after that, it does not. The refresh method eventually calls the onHide() method on the RowEditor class that sets the field variable: "record" to null, and hence our call to ree.getRecord() returns null and we have ourselves a null pointer exception.

    I think that the logic behind the call to refresh(false) (see above) is a bug, can someone please confirm this as it requries an ugly workaround which requires us to constantly have data in our grid before we do anything.

    Cheers,
    Mark

  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


    Can you please post some samplecode so that we know exactly what you do?

    The roweditor is to edit an existing row, not to add a new one.

  3. #3
    Ext User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    markmacumber is on a distinguished road

      0  

    Default


    Quote Originally Posted by sven View Post
    Can you please post some samplecode so that we know exactly what you do?

    The roweditor is to edit an existing row, not to add a new one.
    Hi Sven,

    Yes im aware that the row editor is for editing, the issue is when I programmatically add a a row to the grid (exactly like you do on the sample I posted a link for) via a button on a toolbar, then switch to edit mode on that new record.

    Firstly, we add a listener to the row editor, to fire custom code after the user clicks "Save" on the row editor:

    Code:
       Listener<RowEditorEvent> saveListener = new Listener<RowEditorEvent>() {
                public void handleEvent(RowEditorEvent ree) {
                      Record r = ree.getRecord();
                      //do our thing with the record...
                }
            };
    
    ...
    
    rowEditor.addListener(Events.AfterEdit, saveListener);
    

    Then, when the grid is empty, and we add a first row in the grid via the button:

    Code:
    addQueryButton.addSelectionListener(new SelectionListener<ButtonEvent>() {
                @Override
                public void componentSelected(ButtonEvent ce) {
                    BaseModel newRecord = new BaseModel();
                    newRecord.set("query", "");
                    newRecord.set("originalTotal", "");
                    
                    rowEditor.stopEditing(false);
                    queryGrid.getListStore().insert(newRecord, 0);
                    rowEditor.startEditing(queryGrid.getListStore().indexOf(newRecord), true);
                }
            });
    The grid, at this point, is in edit mode, and when the user (i.e. me) clicks the "Save" button on the row editor, the code:

    Code:
    Record r = ree.getRecord();


    returns null (i.e. r is null)

    Is this enough information to go on with?

  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


    Fixed in SVN.

  5. #5
    Ext User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    markmacumber is on a distinguished road

      0  

    Default


    Thanks Sven, I really appreciate the speed of the fix, this might be a simple question, but whats the best way to get the latest build with the fix?

  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


    Quote Originally Posted by markmacumber View Post
    Thanks Sven, I really appreciate the speed of the fix, this might be a simple question, but whats the best way to get the latest build with the fix?
    You can get a support subscription. This includes SVN access.

    http://www.extjs.com/store/gxt/#support-table

  7. #7
    Ext User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    markmacumber is on a distinguished road

      0  

    Default


    Are there currently plans for any patch releases?

  8. #8
    Ext GWT Premium Member
    Join Date
    Mar 2009
    Posts
    226
    Vote Rating
    3
    The_Jackal is on a distinguished road

      0  

    Default


    I second that - is there any plan to have nightly / weekly trunk builds?

    Alternatively is there a guide to building from trunk?

  9. #9
    Ext User
    Join Date
    Mar 2009
    Posts
    43
    Vote Rating
    0
    markmacumber is on a distinguished road

      0  

    Default


    The guide for building on the trunk can be found in the online docs:

    http://extjs.com/helpcenter/index.jsp

    type in SVN into the search box and click on the SVN setup article...

Thread Participants: 2

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