Apr 17, 2013, 4:32 PM
[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:
If I 1.) Change
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
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]