[CLOSED] GridPanel Batch Update does not send data

Page 2 of 2 FirstFirst 12
  1. #11
    Here I am not able to get updated data while using IsComplex=true and #{StoreStone}.getChangedData({skipIdForNewRecords : true}) method used.

     Runnable Example
    <%@ Page Language="C#" %>

    <%@ Import Namespace="System.Collections.Generic" %>

    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

    <script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    public class CustomStone
    {
    public int? Pcs { get; set; }
    public decimal? Cts { get; set; }
    public long StoneID { get; set; }

    public CustomStone()
    {
    Pcs = 0; Cts = 0; StoneID = 0;
    }
    }

    public class DirectCustomClass
    {
    public CustomStone cStone { get; set; }
    public string DisplayStoneID { get; set; }
    public string DoNotUse { get; set; }
    }


    protected void btnRefersh_Click(object sender, EventArgs e)
    {

    List<DirectCustomClass> lstStone = new List<DirectCustomClass>();
    lstStone.Add(new DirectCustomClass { DisplayStoneID = "x1", cStone = new CustomStone() { StoneID = 1, Pcs = 1, Cts = 2 } });
    lstStone.Add(new DirectCustomClass { DisplayStoneID = "x2", cStone = new CustomStone() { StoneID = 2, Pcs = 1, Cts = 9 } });
    lstStone.Add(new DirectCustomClass { DisplayStoneID = "x3", cStone = new CustomStone() { StoneID = 3, Pcs = 1, Cts = 8 } });
    lstStone.Add(new DirectCustomClass { DisplayStoneID = "x4", cStone = new CustomStone() { StoneID = 4, Pcs = 1, Cts = 7 } });
    StoreStone.DataSource = lstStone.ToList();
    StoreStone.DataBind();
    }

    protected void btnSave_Click(object sender, DirectEventArgs e)
    {
    ChangeRecords<DirectCustomClass> stoneTransferDet = new StoreDataHandler(e.ExtraParams["Stone"]).BatchObjectData<DirectCustomClass>();
    foreach (DirectCustomClass dcc in stoneTransferDet.Updated)
    {
    new MessageBox().Show(new MessageBoxConfig()
    {
    Title = "Pcs Value",
    Message = "New Pcs=" + dcc.cStone.Pcs.Value.ToString(),
    Icon = MessageBox.Icon.INFO,
    Closable = true,
    Buttons = MessageBox.Button.OK
    });
    //base.ShowMessage(dcc.cStone.Pcs.Value.ToString(), MessageBox.Icon.INFO);
    }
    }

    </script>

    <!DOCTYPE html>

    <html>
    <head id="Head1" runat="server">
    <title>Ext.NET Examples</title>

    <script>

    </script>
    </head>
    <body>
    <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />

    <ext:GridPanel ID="GridStone" runat="server" IDMode="Static" Title="Testing Grid" Height="300">
    <Store>
    <ext:Store ID="StoreStone" runat="server" IDMode="Static">
    <Model>
    <ext:Model ID="ModelStone" runat="server" IDMode="Static" IDProperty="StoneID" ClientIdProperty="DoNotUse">
    <Fields>
    <ext:ModelField Name="DisplayStoneID" />
    <ext:ModelField Name="cStone" IsComplex="true">
    </ext:ModelField>
    <ext:ModelField Name="StoneID" ServerMapping="cStone.StoneID" />
    <ext:ModelField Name="Pcs" ServerMapping="cStone.Pcs" />
    <ext:ModelField Name="Cts" ServerMapping="cStone.Cts" />
    <ext:ModelField Name="DoNotUse" />
    </Fields>
    </ext:Model>
    </Model>

    </ext:Store>
    </Store>
    <ColumnModel>
    <Columns>
    <ext:Column ID="Column1" DataIndex="StoneID" runat="server" Text="Stone ID">
    <Editor>
    <ext:TextField ID="txtStoneID" runat="server" IDMode="Static" />
    </Editor>
    </ext:Column>
    <ext:Column ID="Column2" runat="server" Text="Display Stone ID" DataIndex="DisplayStoneID">
    <Editor>
    <ext:TextField ID="txtDisplayStoneID" runat="server" IDMode="Static" />
    </Editor>

    </ext:Column>
    <ext:Column ID="Column3" DataIndex="Pcs" runat="server" Text="Pcs">
    <Editor>
    <ext:NumberField ID="txtPCS" runat="server" IDMode="Static" />
    </Editor>
    </ext:Column>
    <ext:Column ID="Column4" DataIndex="Cts" runat="server" Text="Cts">
    <Editor>
    <ext:NumberField ID="txtCTS" runat="server" IDMode="Static" />
    </Editor>
    </ext:Column>
    </Columns>
    </ColumnModel>
    <Plugins>
    <ext:CellEditing ID="cell1" runat="server" IDMode="Static" />
    </Plugins>
    </ext:GridPanel>
    <ext:Component Width="20" ID="com1" runat="server" />
    <ext:Button ID="btnRefersh" Icon="ArrowRefresh" runat="server" IDMode="Static" Text="Refresh">
    <DirectEvents>
    <Click OnEvent="btnRefersh_Click" />
    </DirectEvents>
    </ext:Button>
    <ext:Button ID="Button2" Icon="DatabaseSave" runat="server" IDMode="Static" Text="Save">
    <DirectEvents>
    <Click OnEvent="btnSave_Click">
    <ExtraParams>
    <ext:Parameter Name="Stone" Value="#{StoreStone}.getChangedData({skipIdForNewR ecords : true})" Mode="Raw" Encode="true" />
    </ExtraParams>
    </Click>
    </DirectEvents>
    </ext:Button>

    </form>
    </body>
    </html>
  2. #12
    The code sample is not wrapped. Also you should not create a new post.

    Please read.

    Quote Originally Posted by Daniil View Post
    Hi @shaileshsakaria,

    Please wrap the code in [CODE] tags, see how to do that here in #3:
    More Information Required
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Batch Update
    By shaileshsakaria in forum 2.x Help
    Replies: 1
    Last Post: Jan 18, 2013, 5:17 PM
  2. [2.1] GridPanelFor Batch Update
    By millenovanta in forum 2.x Help
    Replies: 20
    Last Post: Dec 26, 2012, 1:27 PM
  3. Replies: 2
    Last Post: Jun 16, 2011, 7:50 AM
  4. Replies: 3
    Last Post: Jun 14, 2011, 8:55 AM
  5. How to Update the GridPanel data to the DataSource
    By animalisme in forum 1.x Help
    Replies: 2
    Last Post: Jun 22, 2009, 4:09 AM

Tags for this Thread

Posting Permissions