[CLOSED] Update grid cell value without store.reload()

  1. #1

    [CLOSED] Update grid cell value without store.reload()

    I am trying to update a single cell in a grid on a row editor's AfterEdit Success. I am trying to avoid calling store.reload() as I do not want to make a server call. I've tried to use this.record.data.TestColumn = "TestValue"; and even though it does update the data, it is not reflected in the cell. Refreshing the GridView did not help either.
    Last edited by Daniil; Nov 07, 2011 at 8:39 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Refreshing a grid's view should help. Please clarify how does you do that?

    As well please try:
    this.record.set("TestColumn", "TestValue");
  3. #3
    Here's the code I'm using, still doesn't seem to work:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
    	protected void Page_Load(object sender, EventArgs e)
    	{
    		if (!X.IsAjaxRequest)
    		{
    			var data = this.GetData();
    			var store1 = this.gridMain.GetStore();
    
    			store1.DataSource = data;
    			store1.DataBind();
    		}
    	}
    
    	public object[] GetData()
    	{
    		return new object[] {
                new object[] { "3m Co" },
                new object[] { "Alcoa Inc" },
                new object[] { "Altria Group Inc" },
                new object[] { "American Express Company" },
                new object[] { "American International Group, Inc." },
                new object[] { "AT&T Inc." }
            };
    	}
    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
    	<form id="Form1" runat="server">
    	<ext:ResourceManager ID="ResourceManager1" runat="server" />
    	<ext:GridPanel ID="gridMain" runat="server" StripeRows="true" TrackMouseOver="true"
    		Width="600" Height="350" AutoExpandColumn="Company">
    		<Store>
    			<ext:Store ID="Store1" runat="server">
    				<Reader>
    					<ext:ArrayReader>
    						<Fields>
    							<ext:RecordField Name="Company" />
    						</Fields>
    						<Fields>
    							<ext:RecordField Name="TestColumn" />
    						</Fields>
    					</ext:ArrayReader>
    				</Reader>
    			</ext:Store>
    		</Store>
    		<ColumnModel ID="ColumnModel1" runat="server">
    			<Columns>
    				<ext:Column ColumnID="Company" Header="Company" Width="160" DataIndex="Company">
    					<Editor>
    						<ext:TextField ID="txtCompany" DataIndex="Company">
    						</ext:TextField>
    					</Editor>
    				</ext:Column>
    				<ext:Column ColumnID="TestColumn" Header="TestColumn" Width="160" DataIndex="TestColumn" />
    			</Columns>
    		</ColumnModel>
    		<SelectionModel>
    			<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true" />
    		</SelectionModel>
    		<View>
    			<ext:GridView ID="GridView1" runat="server">
    			</ext:GridView>
    		</View>
    		<Plugins>
    			<ext:RowEditor runat="server">
    				<DirectEvents>
    					<AfterEdit Success="this.record.set('TestColumn', 'TestValue'); #{gridMain}.getView().refresh();">
    					</AfterEdit>
    				</DirectEvents>
    			</ext:RowEditor>
    		</Plugins>
    	</ext:GridPanel>
    	</form>
    </body>
    </html>
  4. #4
    A scope of a Success handler is not a RowEditor.

    To get it working please replace:
    this.record.set(...);
    with
    r.set();
    And you don't need to call the .refresh() method, if you use the record's .set() method.

Similar Threads

  1. reload store (grid) from treepanel
    By simbal in forum 1.x Help
    Replies: 1
    Last Post: Apr 28, 2012, 10:57 AM
  2. Replies: 1
    Last Post: Dec 22, 2011, 7:17 AM
  3. [CLOSED] reload store and grid on client side
    By ryan.kim in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 12, 2011, 1:39 PM
  4. [CLOSED] Reset store's sort info on grid reload/reconfigure
    By jchau in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 10, 2010, 5:06 PM
  5. [CLOSED] [1.0] Paged grid displays all records on store's reload
    By danielg in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jan 25, 2010, 12:26 PM

Posting Permissions