Changes aren't reflected on grid with Ext.data.Record.set('field', value)

  1. #1

    [1.6] Changes aren't reflected on grid with Ext.data.Record.set('field', value)

    It's a pretty small problem but it's been bugging me for a while. Let's go with a very simplified example:

    Store:

        <ext:Store ID="myStore" runat="server" UseIdConfirmation="true">
            <Reader>
                <ext:JsonReader IDProperty="fieldId">
                    <Fields>
                        <ext:RecordField Name="myField" Type="String" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
    Grid:

        <ext:GridPanel ID="myGrid" runat="server" StoreID="myStore Width="200">
            <ColumnModel>
                <Columns>
                    <ext:Column ColumnID="myField" Header='My Field' DataIndex="myField" AutoDataBind="true" Width="180" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" MoveEditorOnEnter="false" SingleSelect="true" />
            </SelectionModel>
        </ext:GridPanel>
    For simplicity's sake, let's say I have the following inside a button's listener into the grid:

        <Click Handler="changeRowValue(rowIndex, myGrid)" />
    Javascript snippet:

        var newValue = 'foo';
    
        var changeRowValue = function(rowIndex, grd){
            var store = grd.getStore();
            store.getAt(rowIndex).set('myField', newValue);
        }
    This way, the store value is updated but it won't show 'foo' in the grid.

    I know a simple

       grd.view.refresh()
    will update the grid, but it cleans the "dirt" and I'd like it dirty (that sounded nasty) to give the user feedback that the value hasn't been commited yet (you know, the small red arrow in the upper right corner).

    This isn't a big deal in any extent and I know it can be done because I've done it before (I just can't remember where or how), so what's wrong here?

    PS: I can't stress enough that this is a VERY simplified vision of the actual problem so there might be something in-between messing things up, but I find it to be very unlikely.
    Last edited by khor; Oct 22, 2013 at 5:02 PM.
  2. #2
    Hi @khor,

    A record's set call should update a respective row in the GridPanel for sure.

    Unfortunately, the code snippets that you provided is not enough to understand the problem.

    Please provide more details. A full test case is best.
  3. #3
    Ok Daniil, I'll try to extract a more comprehensive set from the actual code and I'll get back to this issue. Posting it as it is would take a lot of explaining.
  4. #4
    I dug around a lot and found out that for some reason, calling changeRowValue before making some other changes (which have nothing to do with the store/grid in question) will update the grid correctly. I couldn't figure out exactly what is causing the problem so I won't risk posting any solutions. Since I'm new to posting into the forums, I couldn't find how to mark the thread as closed, so you may close it if you find it appropriate. Many thanks.
  5. #5
    Nice that you found a solution. If you be able to provide us with a test case ever, then we will be glad to investigate.

    Quote Originally Posted by khor View Post
    I couldn't find how to mark the thread as closed
    Please don't worry. We do it ourselves. Moreover, we mark as closed on the premium forums only.

Similar Threads

  1. [CLOSED] Record changes not being reflected
    By OriCoder in forum 2.x Legacy Premium Help
    Replies: 8
    Last Post: May 30, 2013, 4:18 PM
  2. Replies: 0
    Last Post: Nov 20, 2012, 1:08 PM
  3. [CLOSED] Store Filter not reflected in Grid
    By GLD in forum 1.x Legacy Premium Help
    Replies: 13
    Last Post: Nov 29, 2011, 10:15 AM
  4. Data updated in store with e.record.set() is not getting reflected in grid
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: May 07, 2010, 5:16 AM
  5. [CLOSED] Grid record.data for AjaxMethods
    By macap in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 05, 2010, 5:08 AM

Tags for this Thread

Posting Permissions