德仔

工作学习之笔记

Combox 下拉显示多列

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserAdd.aspx.cs" Inherits="Admin_UserAdd" %>

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>新增用户</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
   
    <style type="text/css">
        .cbStates-list
        {
            width: 298px;
            font: 11px tahoma,arial,helvetica,sans-serif;
        }
       
        .cbStates-list th {
            font-weight: bold;
        }
       
        .cbStates-list td, .cbStates-list th {
            padding: 3px;
        }
    </style>

</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
                <ext:Store ID="Store1" runat="server">
            <Reader>
                <ext:JsonReader>
                    <Fields>
                        <ext:RecordField Name="name" />
                        <ext:RecordField Name="workno" />
                    </Fields>
                </ext:JsonReader>
            </Reader>           
        </ext:Store>


        <ext:FormPanel ID="FormPanel1" runat="server" ButtonAlign="Right" Height="250"
            Padding="5" Title="新增用户" Width="350">
            <Items>
                <ext:TextField ID="txtusercode" runat="server" FieldLabel="用户账号" EmptyText="请输入账号">
                </ext:TextField>
                <ext:TextField ID="txtpassword" runat="server" FieldLabel="用户密码" EmptyText="请输入密码">
                </ext:TextField>
                <ext:TextField ID="txtname" runat="server" FieldLabel="姓名" EmptyText="请输入姓名">
                </ext:TextField>
                <ext:ComboBox
            ID="cbxworkno"
            runat="server"
            EmptyText="请选择员工工号"
            TypeAhead="true"
            ForceSelection="true"
            StoreID="Store1"
            DisplayField="workno"
            ValueField="name"
            MinChars="1"
            ListWidth="300"
            PageSize="10"
            ItemSelector="tr.list-item" FieldLabel="工号"
            >
            <Template ID="Template1" runat="server">
                <Html>
     <tpl for=".">
      <tpl if="[xindex] == 1">
       <table class="cbStates-list">
        <tr>
         <th>员工姓名</th>
         <th>员工工号</th>
        </tr>
      </tpl>
      <tr class="list-item">
       <td style="padding:3px 0px;">{name}</td>
       <td>{workno}</td>
      </tr>
      <tpl if="[xcount-xindex]==0">
       </table>
      </tpl>
     </tpl>
    </Html>
            </Template>
            <Triggers>
                <ext:FieldTrigger Icon="Clear" HideTrigger="true" />
            </Triggers>
            <Listeners>
                <BeforeQuery Handler="this.triggers[0][ this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
                <TriggerClick Handler="if (index == 0) { el.focus().clearValue(); trigger.hide();}" />
             
                 <Select Handler="function(el){el.triggers[0].show();}" />
            </Listeners>
        </ext:ComboBox>          

                 <ext:ComboBox ID="cbxsex" runat="server" FieldLabel="性别" Width="100" EmptyText="请选择性别">
                     <Items>
                         <ext:ListItem Text="男" Value="男" />
                         <ext:ListItem Text="女" Value="女" />
                     </Items>
                </ext:ComboBox>
                <ext:TextField ID="txtemail" runat="server" FieldLabel="电子邮件" Width="160" EmptyText="请输入电子邮件">
                </ext:TextField>
            </Items>
            <Buttons>
                <ext:Button runat="server" Icon="Disk" Text="Submit" />
            </Buttons>
        </ext:FormPanel>
   
    </div>
    </form>
</body>
</html>
官方网站的写法是<Select Handler="el.triggers[0].show();" />
报错

应该是版本差异:

为了保险起见,你还是定义完整的方法:
 <Select Handler="function(el){el.triggers[0].show();}" />
 Renamed the standard first parameter of Component Listener arguments to "item". Previous parameter name was "el".

 

阅读更多

扫码向博主提问

去开通我的Chat快问

david_520042

博客专家

非学,无以致疑;非问,无以广识
  • 擅长领域:
  • ERP
  • .NET
  • SQL
  • Ext.Net
  • DevExpress
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/david_520042/article/details/6120010
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

Combox 下拉显示多列

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭