<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據

        來源:懂視網 責編:小采 時間:2020-11-27 22:44:17
        文檔

        Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據

        Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據:官方有一個關于Grid CURD 的例子:http://examples.coolite.com/Examples/GridPanel/WebService_Connections/HandlerUsing/ 我在其基礎上稍微修改一下, 用ComboBox作為Grid的Editor: 先show一下效果給大家堅持看下去的動力:
        推薦度:
        導讀Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據:官方有一個關于Grid CURD 的例子:http://examples.coolite.com/Examples/GridPanel/WebService_Connections/HandlerUsing/ 我在其基礎上稍微修改一下, 用ComboBox作為Grid的Editor: 先show一下效果給大家堅持看下去的動力:

        官方有一個關于Grid CURD 的例子:http://examples.coolite.com/Examples/GridPanel/WebService_Connections/HandlerUsing/   我在其基礎上稍微修改一下, 用ComboBox作為Grid的Editor:

         

        先show一下效果給大家堅持看下去的動力:

        關鍵代碼:
        代碼如下:
        <ext:Column ColumnID="ContactName" DataIndex="ContactName" Header="Contact Name"
        Width="150">
        <Editor>
        <ext:ComboBox ID="ComboBox1" runat="server" StoreID="stoContactName" DisplayField="Name"
        ValueField="Name" TypeAhead="false" LoadingText="Searching..." Width="570" PageSize="10"
        Editable="true" Mode="Remote" MinListWidth="200" ItemSelector="tr.search-item"
        MinChars="1" MsgTarget="Side" TriggerAction="All" Grow="true">
        <CustomConfig>
        <ext:ConfigItem Name="tpl" Value="#{TplContactName}" Mode="Raw" />
        </CustomConfig>
        </ext:ComboBox>
        </Editor>
        </ext:Column>

        由于ComboBox作為Editor,是不能直接配置模板的,所以模板要獨立寫:
        代碼如下:
        <ext:XTemplate ID="TplContactName" runat="server">
        <div>
        <table id="data_table" class="t1">
        <thead>
        <tr>
        <th>
        Name
        </th>
        <th>
        Desc
        </th>
        </tr>
        </thead>
        <tbody>
        <tpl for=".">
        <tr class="search-item">
        <td>{Name}</td>
        <td>{Desc}</td>
        </tr>
        </tpl>
        </tbody>
        </table>
        </div>
        </ext:XTemplate>

        再加上這個比較Cool的table樣式就基本上完成了:
        代碼如下:

        body, table.t1
        {
        font-size: 12px;
        }
        table.t1
        {
        table-layout: fixed;
        empty-cells: show;
        border-collapse: collapse;
        margin: 0 auto;
        }
        td
        {
        height: 20px;
        }
        h1, h2, h3
        {
        font-size: 12px;
        margin: 0;
        padding: 0;
        }
        table.t1
        {
        border: 1px solid #cad9ea;
        color: #666;
        }
        table.t1 th
        {
        background-image: url(/extjs/resources/images/default/panel/white-top-bottom-gif/coolite.axd);
        background-repeat: repeat-x;
        height: 22px;
        }
        table.t1 td, table.t1 th
        {
        border: 1px solid #cad9ea;
        padding: 0 1em 0;
        }
        table.t1 tr.a1
        {
        background-color: #f5fafe;
        }

        Enjoy yourself!
        完整的代碼:
        Html
        代碼如下:
        <%@ Page Language="C#" AutoEventWireup="true"%>
        <%@ 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">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
        <title></title>
        <style type="text/css"><!--
        body, table.t1
        {
        font-size: 12px;
        }
        table.t1
        {
        table-layout: fixed;
        empty-cells: show;
        border-collapse: collapse;
        margin: 0 auto;
        }
        td
        {
        height: 20px;
        }
        h1, h2, h3
        {
        font-size: 12px;
        margin: 0;
        padding: 0;
        }
        table.t1
        {
        border: 1px solid #cad9ea;
        color: #666;
        }
        table.t1 th
        {
        background-image: url(/extjs/resources/images/default/panel/white-top-bottom-gif/coolite.axd);
        background-repeat: repeat-x;
        height: 22px;
        }
        table.t1 td, table.t1 th
        {
        border: 1px solid #cad9ea;
        padding: 0 1em 0;
        }
        table.t1 tr.a1
        {
        background-color: #f5fafe;
        }

        --></style><style type="text/css" bogus="1"> body, table.t1
        {
        font-size: 12px;
        }
        table.t1
        {
        table-layout: fixed;
        empty-cells: show;
        border-collapse: collapse;
        margin: 0 auto;
        }
        td
        {
        height: 20px;
        }
        h1, h2, h3
        {
        font-size: 12px;
        margin: 0;
        padding: 0;
        }
        table.t1
        {
        border: 1px solid #cad9ea;
        color: #666;
        }
        table.t1 th
        {
        background-image: url(/extjs/resources/images/default/panel/white-top-bottom-gif/coolite.axd);
        background-repeat: repeat-x;
        height: 22px;
        }
        table.t1 td, table.t1 th
        {
        border: 1px solid #cad9ea;
        padding: 0 1em 0;
        }
        table.t1 tr.a1
        {
        background-color: #f5fafe;
        }
        </style>
        </head>
        <body>
        <ext:ScriptManager ID="ScriptManager1" runat="server" />
        <form id="form1" runat="server">
        <div>
        <ext:Store runat="server" ID="stoContactName">
        <Proxy>
        <ext:HttpProxy Url="CustomerHandler.ashx?action=contact" />
        </Proxy>
        <Reader>
        <ext:JsonReader Root="data" TotalProperty="totalCount">
        <Fields>
        <ext:RecordField Name="Name" />
        <ext:RecordField Name="Desc" />
        </Fields>
        </ext:JsonReader>
        </Reader>
        </ext:Store>
        <ext:XTemplate ID="TplContactName" runat="server">
        <div>
        <table id="data_table" class="t1">
        <thead>
        <tr>
        <th>
        Name
        </th>
        <th>
        Desc
        </th>
        </tr>
        </thead>
        <tbody>
        <tpl for=".">
        <tr class="search-item">
        <td>{Name}</td>
        <td>{Desc}</td>
        </tr>
        </tpl>
        </tbody>
        </table>
        </div>
        </ext:XTemplate>
        <ext:Store ID="dsCustomers" runat="server" RemoteSort="true" UseIdConfirmation="true">
        <Proxy>
        <ext:HttpProxy Url="CustomerHandler.ashx?action=query" />
        </Proxy>
        <UpdateProxy>
        <ext:HttpWriteProxy Url="CustomerHandler.ashx?action=save" />
        </UpdateProxy>
        <Reader>
        <ext:JsonReader ReaderID="CustomerID" Root="data" TotalProperty="totalCount">
        <Fields>
        <ext:RecordField Name="CustomerID" SortDir="ASC" />
        <ext:RecordField Name="CompanyName" />
        <ext:RecordField Name="ContactName" />
        <ext:RecordField Name="Email" />
        <ext:RecordField Name="Phone" />
        <ext:RecordField Name="Fax" />
        <ext:RecordField Name="Region" />
        <ext:RecordField Name="TranDate" Type="Date" />
        </Fields>
        </ext:JsonReader>
        </Reader>
        <BaseParams>
        <ext:Parameter Name="limit" Value="15" Mode="Raw" />
        <ext:Parameter Name="start" Value="0" Mode="Raw" />
        <ext:Parameter Name="dir" Value="ASC" />
        <ext:Parameter Name="sort" Value="CustomerID" />
        </BaseParams>
        <SortInfo Field="CustomerID" Direction="ASC" />
        </ext:Store>
        <ext:ViewPort ID="ViewPort1" runat="server">
        <Body>
        <ext:FitLayout ID="FitLayout1" runat="server">
        <ext:GridPanel ID="GridPanel1" runat="server" Header="false" Border="false" StoreID="dsCustomers"
        TrackMouseOver="true" ClicksToEdit="1" AutoExpandColumn="CompanyName" Height="500">
        <ColumnModel ID="ColumnModel1" runat="server">
        <Columns>
        <ext:Column ColumnID="CustomerID" DataIndex="CustomerID" Header="ID">
        <Editor>
        <ext:TextField ID="TextField1" runat="server" MaxLength="5" AllowBlank="false" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="TranDate" DataIndex="TranDate" Header="Tran Date">
        <Editor>
        <ext:DateField ID="DateField1" runat="server" Format="yyyy-MM-dd" MsgTarget="Side" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="CompanyName" DataIndex="CompanyName" Header="Company Name">
        <Editor>
        <ext:TextField ID="TextField2" runat="server" AllowBlank="false" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="ContactName" DataIndex="ContactName" Header="Contact Name"
        Width="150">
        <Editor>
        <ext:ComboBox ID="ComboBox1" runat="server" StoreID="stoContactName" DisplayField="Name"
        ValueField="Name" TypeAhead="false" LoadingText="Searching..." Width="570" PageSize="10"
        Editable="true" Mode="Remote" MinListWidth="200" ItemSelector="tr.search-item"
        MinChars="1" MsgTarget="Side" TriggerAction="All" Grow="true">
        <CustomConfig>
        <ext:ConfigItem Name="tpl" Value="#{TplContactName}" Mode="Raw" />
        </CustomConfig>
        </ext:ComboBox>
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="Email" DataIndex="Email" Header="Email">
        <Editor>
        <ext:TextField ID="TextField4" runat="server" Vtype="email" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="Phone" DataIndex="Phone" Header="Phone">
        <Editor>
        <ext:TextField ID="TextField5" runat="server" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="Fax" DataIndex="Fax" Header="Fax">
        <Editor>
        <ext:TextField ID="TextField6" runat="server" />
        </Editor>
        </ext:Column>
        <ext:Column ColumnID="Region" DataIndex="Region" Header="Region">
        <Editor>
        <ext:TextField ID="TextField7" runat="server" />
        </Editor>
        </ext:Column>
        </Columns>
        </ColumnModel>
        <TopBar>
        <ext:Toolbar ID="Toolbar1" runat="server">
        <Items>
        <ext:Button ID="Button1" runat="server" Text="Save" Icon="Disk">
        <Listeners>
        <Click Handler="#{dsCustomers}.save();" />
        </Listeners>
        </ext:Button>
        <ext:Button ID="Button3" runat="server" Text="Add" Icon="Add">
        <Listeners>
        <Click Handler="#{GridPanel1}.insertRecord(0, {});#{GridPanel1}.getView().focusRow(0);#{GridPanel1}.startEditing(0, 0);" />
        </Listeners>
        </ext:Button>
        <ext:Button ID="Button2" runat="server" Text="Reject Changes" Icon="ArrowUndo">
        <Listeners>
        <Click Handler="#{dsCustomers}.rejectChanges();" />
        </Listeners>
        </ext:Button>
        </Items>
        </ext:Toolbar>
        </TopBar>
        <BottomBar>
        <ext:PagingToolBar ID="PagingToolbar1" runat="server" StoreID="dsCustomers" PageSize="15" />
        </BottomBar>
        <Listeners>
        <BeforeEdit Handler="return !(e.field=='CustomerID' && !e.record.newRecord);" />
        </Listeners>
        <LoadMask ShowMask="true" />
        <SaveMask ShowMask="true" />
        </ext:GridPanel>
        </ext:FitLayout>
        </Body>
        </ext:ViewPort>
        </div>
        </form>
        </body>
        </html>

        CustomerHandler.ashx
        代碼如下:
        using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Web;
        using Coolite.Ext.Web;
        namespace WebSPN.Controllers
        {
        /// <summary>
        /// Summary description for $codebehindclassname$
        /// </summary>
        //[WebService(Namespace = "http://tempuri.org/")]
        //[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        public class CustomerHandler : IHttpHandler
        {
        public void ProcessRequest(HttpContext context)
        {
        context.Response.ContentType = "text/plain";
        string json = "";
        var Request =context.Request;
        string action= Request["action"];
        if (action == "query")
        {
        Random rand=new Random();
        int limit =int .Parse ( Request["limit"]);
        int start =int .Parse ( Request["start"]);
        IList<Customer> list = new List<Customer>();
        for (int i = start; i < start + limit; i++)
        list.Add(new Customer
        {
        CustomerID = "Customer" +i,
        Address = "Address" +i,
        City = "City" + rand.Next(1000),
        CompanyName = "Com" + rand.Next(1000),
        ContactName = "Contract" + rand.Next(1000),
        ContactTitle = "Title" + rand.Next(1000),
        Country = "Country" + rand.Next(1000),
        Email = rand.Next(1000) + "@live.com",
        Fax = rand.Next(1000).ToString() + rand.Next(1000),
        Mobile = rand.Next(1000).ToString() + rand.Next(1000),
        Notes = "Notes" + rand.Next(1000),
        Phone = "Phone" + rand.Next(1000),
        Region = "Region" + rand.Next(1000),
        TranDate =DateTime .Now .AddDays(rand.Next(30))
        });
        json= Coolite.Ext.Web.JSON.Serialize(list);
        json = "{data:" + json + ", totalCount:" + 100 + "}";
        context.Response.Write(json);
        }
        else if (action == "save")
        {
        //saving
        StoreDataHandler dataHandler = new StoreDataHandler( Request["data"]);
        ChangeRecords<Customer> data = dataHandler.ObjectData<Customer>();
        foreach (Customer customer in data.Deleted)
        {
        //db.Customers.Attach(customer);
        //db.Customers.DeleteOnSubmit(customer);
        }
        foreach (Customer customer in data.Updated)
        {
        //db.Customers.Attach(customer);
        //db.Refresh(RefreshMode.KeepCurrentValues, customer);
        }
        foreach (Customer customer in data.Created)
        {
        //db.Customers.InsertOnSubmit(customer);
        }
        //db.SubmitChanges();
        Response sr = new Response(true);
        sr.Success = true;
        sr.Write();
        }
        else if (action == "contact")
        {
        string query = Request["query"]??"";
        json = "[{Name:'Bruce Lee query:"+query +"',Desc:'skjfkasjdkf'},{Name:'zzz',Desc:'sffffkf'},{Name:'ssse',Desc:'zzzzzzasjdkf'},"+
        "{Name:'Bruce Lee" + DateTime.Now + "',Desc:'skzzjdkf'},{Name:'zzz',Desc:'sffffkf'},{Name:'ssse',Desc:'zzzzzzasjdkf'}," +
        "{Name:'Bruce Lee',Desc:'" + DateTime.Now + "'},{Name:'zzz',Desc:'sffffkf'},{Name:'ssse',Desc:'zzzzzzasjdkf'}" +
        "]";
        json = "{data:" + json + ", totalCount:" + 20 + "}";
        context.Response.Write(json);
        }
        }
        public bool IsReusable
        {
        get
        {
        return false;
        }
        }
        }
        public partial class Customer
        {
        public string CustomerID { get; set; }
        public string CompanyName { get; set; }
        public string ContactName { get; set; }
        public string ContactTitle { get; set; }
        public string Address { get; set; }
        public string City { get; set; }
        public string Region { get; set; }
        public string PostalCode { get; set; }
        public string Country { get; set; }
        public string Phone { get; set; }
        public string Fax { get; set; }
        public string Mobile { get; set; }
        public string Email { get; set; }

        public string WebPage { get; set; }
        public string Notes { get; set; }
        public DateTime TranDate { get; set; }
        }
        }

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據

        Coolite Cool Study 1 在Grid中用ComboBox 來編輯數據:官方有一個關于Grid CURD 的例子:http://examples.coolite.com/Examples/GridPanel/WebService_Connections/HandlerUsing/ 我在其基礎上稍微修改一下, 用ComboBox作為Grid的Editor: 先show一下效果給大家堅持看下去的動力:
        推薦度:
        標簽: cool co study
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲高清专区日韩精品| 好大好深好猛好爽视频免费| 精品女同一区二区三区免费播放| 亚洲中文字幕久久精品无码VA| 亚洲国产av玩弄放荡人妇| 一个人晚上在线观看的免费视频| 国产免费无码AV片在线观看不卡| 久久大香香蕉国产免费网站| 最近中文字幕免费mv视频8| 亚洲国产成人久久笫一页| 亚洲AV天天做在线观看| 亚洲av无码日韩av无码网站冲| 久久大香香蕉国产免费网站| 久久亚洲国产精品五月天| 99在线热视频只有精品免费| 免费一看一级毛片| 77777亚洲午夜久久多喷| 成在人线av无码免费高潮喷水| 在线免费观看污网站| 免费播放美女一级毛片| 亚洲国产婷婷香蕉久久久久久| 亚洲第一页在线播放| 国产成人高清精品免费观看| 女人18毛片免费观看| 男性gay黄免费网站| 亚洲无线观看国产精品| 美景之屋4在线未删减免费| 免费电影在线观看网站| 婷婷精品国产亚洲AV麻豆不片 | 国产成人免费a在线视频色戒| 亚洲人成电影在在线观看网色 | 国产高潮流白浆喷水免费A片 | 亚洲av伊人久久综合密臀性色| 免费一级毛片在线播放放视频| 欧美好看的免费电影在线观看 | 久久夜色精品国产噜噜亚洲AV| 国产免费内射又粗又爽密桃视频| 女人张开腿给人桶免费视频| 一级毛片不卡免费看老司机| 亚洲精品456在线播放| 亚洲国产成人久久综合一区77 |