[ADDED] [V0.8.2] ServerMapping

  1. #1

    [ADDED] [V0.8.2] ServerMapping

    Hello,

    I was wondering if the SVN users could get an early preview implementation of the ServerMapping feature for the Store control. I'm working on a large application that uses enterprise mapping layers where I do not want to implement data transfer objects for presentation layer functions.

    Would it be possible at this point to implement some basic ServerMapping functions?

    Cheers as always,
    Timothy
  2. #2

    RE: [ADDED] [V0.8.2] ServerMapping

    Hi,

    Added. Please update from SVN and test

    Here is my test case
    <%@ Page Language="C#" %>
    
    <%@ Import Namespace="System.Collections.Generic" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" 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)
            {
                Store1.DataSource = Employee.GetAll();
                Store1.DataBind();
            }
    
            public class Employee
            {
                public int ID { get; set; }
                public string Name { get; set; }
                public string Surname { get; set; }
                public Department Department { get; set; }
    
                public static List<Employee> GetAll()
                {
                    return new List<Employee>
                               {
                                   new Employee
                                       {
                                           ID = 1,
                                           Name = "Nancy",
                                           Surname = "Davolio",
                                           Department = Department.GetAll()[0]
                                       },
                                   new Employee
                                       {
                                           ID = 2,
                                           Name = "Andrew",
                                           Surname = "Fuller",
                                           Department = Department.GetAll()[2]
                                       }
                               };
                }
            }
    
            public class Department
            {
                public int ID { get; set; }
                public string Name { get; set; }
    
                public static List<Department> GetAll()
                {
                    return new List<Department>
                               {
                                   new Department {ID = 1, Name = "Department A"},
                                   new Department {ID = 2, Name = "Department B"},
                                   new Department {ID = 3, Name = "Department C"}
                               };
                }
            }
    
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Coolite Toolkit Example - Server Mapping</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <form id="form1" runat="server">
            <ext:ScriptManager ID="ScriptManager1" runat="server" />
            
            <ext:Store ID="Store1" runat="server">
                <Reader>
                    <ext:JsonReader ReaderID="ID">
                        <Fields>
                            <ext:RecordField Name="ID" Type="Int" />
                            <ext:RecordField Name="Name" />
                            <ext:RecordField Name="Surname" />
                            <ext:RecordField Name="Department" ServerMapping="Department.Name" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
            
            <ext:GridPanel ID="GridPanel1" EnableViewState="true" AutoHeight="true" runat="server"
                StoreID="Store1" Title="List" Icon="Application">
                <ColumnModel ID="ColumnModel1" runat="server">                
                    <Columns>
                        <ext:Column Header="ID" Sortable="true" DataIndex="ID" />
                        <ext:Column Header="NAME" Sortable="true" DataIndex="Name" />
                        <ext:Column Header="SURNAME" Sortable="true" DataIndex="Surname" />
                        <ext:Column DataIndex="Department" Header="Department" Width="240"/>
                    </Columns>
                </ColumnModel>
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                </SelectionModel>
                <LoadMask Msg="Loading" ShowMask="true" />
            </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3

    RE: [ADDED] [V0.8.2] ServerMapping

    Thanks vladimir,

    You're the best! This will definitely make life easier :)

    Cheers,
    Timothy

Similar Threads

  1. Replies: 12
    Last Post: Jun 04, 2012, 11:18 AM
  2. Replies: 6
    Last Post: Feb 23, 2011, 1:05 PM
  3. ServerMapping with more attribute
    By Maia in forum 1.x Help
    Replies: 3
    Last Post: Aug 12, 2010, 4:48 PM
  4. Replies: 1
    Last Post: May 19, 2010, 5:35 AM

Posting Permissions