[CLOSED] Mapping on ModelField

  1. #1

    [CLOSED] Mapping on ModelField

    Hi, folks! I'm having a problem with the "Mapping" attribute on the "ext:ModelField" element in trunk rev. 5024 (4/15/2013).


    If I use the following code:

    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            { 
                List<ItemClass> MyList = new List<ItemClass>
                {
                    new ItemClass(itemid: 1, itemname: "Book"),
                    new ItemClass(itemid: 2, itemname: "CD"),
                    new ItemClass(itemid: 3, itemname: "DVD"),
                    new ItemClass(itemid: 4, itemname: "Phone")
                };
    
                this.ItemStore.DataSource = MyList;
                
                if (!X.IsAjaxRequest)
                {
                    this.ItemStore.DataBind();
                    
                }
            }
            
            public class ItemClass
            {
                public int ItemID { get; set; }
                public string ItemName { get; set; }
    
    
                public ItemClass() { }
                public ItemClass(int itemid = 0, string itemname = "")
                {
                    ItemID = itemid;
                    ItemName = itemname;
                }
            }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
        <ext:ResourceManager ID="ResourceManager" runat="server" />
        <ext:Store ID="ItemStore" runat="server">
            <Model>
                <ext:Model ID="ItemStoreModel" runat="server" IDProperty="ItemID">
                    <Fields>
                        <ext:ModelField Name="ItemID" Type="Int" />
                        <ext:ModelField Name="fakeName" Mapping="ItemName" Type="String" />
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
        <ext:GridPanel runat="server" ID="ItemGridPanel" Title="Items" ClientIDMode="Static" StoreID="ItemStore">
            <ColumnModel ID="ItemsColumnModel" runat="server">
                <Columns>
                    <ext:Column runat="server" ID="Column_ItemID" Text="Item ID" DataIndex="ItemID" />
                    <ext:Column runat="server" ID="Column_ItemName" Text="Item Name" DataIndex="fakeName" />
                </Columns>
            </ColumnModel>
        </ext:GridPanel>
        </form>
    </body>
    </html>
    the "Item Name" column is not populated.


    If I 1.) Change

                        <ext:ModelField Name="ItemID" Type="Int" />
                        <ext:ModelField Name="fakeName" Mapping="ItemName" Type="String" />
    to the following

                        <ext:ModelField Name="ItemID" Type="Int" />
                        <ext:ModelField Name="ItemName" Type="String" />
                        <ext:ModelField Name="fakeName" Mapping="ItemName" Type="String" />
    or 2.) Change

                        <ext:ModelField Name="ItemID" Type="Int" />
                        <ext:ModelField Name="fakeName" Mapping="ItemName" Type="String" />
    to the following

                        <ext:ModelField Name="ItemID" Type="Int" />
                        <ext:ModelField Name="ItemName" Type="String" />
    and change

                    <ext:Column runat="server" ID="Column_ItemName" Text="Item Name" DataIndex="fakeName" />
    to

                    <ext:Column runat="server" ID="Column_ItemName" Text="Item Name" DataIndex="ItemName" />
    Or 3.) if change no code but revert back to Trunk rev. 4975 (4/3/2013), the "Item Name" column is populated as expected.


    Tested in multiple browsers, but my current reference browser is Chrome 26.0.1410.43 on Win7.

    Let me know if you need any more information on this, or if I'm just missing something. Thanks!

    Patrick
    Last edited by Baidaly; Apr 18, 2013 at 12:45 AM. Reason: [CLOSED]
  2. #2
    Please use ServerMapping, Mapping is used on the client side only now
  3. #3
    Quote Originally Posted by Vladimir View Post
    Please use ServerMapping, Mapping is used on the client side only now
    Thank you, that fixed it!
  4. #4
    When was this change or fixed applied. As Patrick said it worked before on rev. 4975 (4/3/2013) when he just used Mapping.

    I will look at the SNV log when I get home tonight.
    Last edited by cwolcott; Apr 17, 2013 at 8:34 PM.
  5. #5
    Never-mind, I see that it was actually rev 5024 (Apr 15, 2013) where the change was made. I will need to examine my code carefully to see where things might break because of this change.

    [UPDATE] Mapping property of ModelField doesn't participate in server side parsing anymore (when store is bound), use ServerMapping
    Should there be a note in the BREAKING CHANGES doc.
  6. #6
    Hello!

    Quote Originally Posted by cwolcott View Post
    Never-mind, I see that it was actually rev 5024 (Apr 15, 2013) where the change was made. I will need to examine my code carefully to see where things might break because of this change.



    Should there be a note in the BREAKING CHANGES doc.
    Thank you! Comment has been added to the Breaking Changes

Similar Threads

  1. [CLOSED] ModelField DateFormat problem
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 01, 2013, 12:40 PM
  2. ext:ModelField Mapping attribute not working
    By jbarbeau in forum 2.x Help
    Replies: 5
    Last Post: Jan 14, 2013, 10:01 AM
  3. Replies: 3
    Last Post: Jul 17, 2012, 1:44 PM
  4. ListFilter_Remote with Mapping
    By howardyin in forum 2.x Help
    Replies: 0
    Last Post: Apr 28, 2012, 4:03 AM
  5. [CLOSED] RecordField vs ModelField and Reconfigure vs Render
    By Sevilay Tanış in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 13, 2012, 3:20 PM

Posting Permissions