• 下拉框自动完成(autocomplete)带有分页功能SutaraLumpur-jquery.ajaxComboBox.js的使用


    效果图:

    SutaraLumpur-jquery.ajaxComboBox.js简介地址:http://d.hatena.ne.jp/sutara_lumpur/20090124/1232781879

    下载地址:https://github.com/SutaraLumpur/jquery.ajaxComboBox.js/zipball/master

    html代码:

    <input type="text" name="txtZdType" id="txtZdType" autocomplete="off" />
    javascript代码:
        <script src="../Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
        <link href="../Scripts/acbox/jquery.ajaxComboBox.css" rel="stylesheet" type="text/css" />
        <script src="../Scripts/acbox/jquery.ajaxComboBox.7.1.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                //选择入院诊断Ajax自动完成
                $('#txtZdType').ajaxComboBox("/WebService/AjaxService.asmx/GetBaicd", { lang: 'en', per_page: 15, field: 'Name', list_field: 'py' });
            });
        </script>
    C#  WebService代码:
            /// <summary>
            /// 根据传人的参数,分页的诊断数据
            /// </summary>
            /// <param name="page_num">当前页码</param>
            /// <param name="per_page">每页显示条数</param>
            [WebMethod]
            public void GetBaicd(int page_num, int per_page)
            {
                //string and_or, string db_table, string[][] order_by, string[][] desc, string[] search_field;
                HttpRequest Request = HttpContext.Current.Request;
                string q_word = Request["q_word[]"];
                ba_icd10BLL bll = new ba_icd10BLL();
                int count = bll.GetCount();//总条数
                StringBuilder sb = new StringBuilder();
                sb.Append("{"result":");
                string strWhere = "";
                if (!string.IsNullOrWhiteSpace(q_word))
                {
                    strWhere = string.Format("where Py like '{0}%' or Name like '{0}%'", q_word);
                }
                List<ba_icd10Info> lst = bll.GetPagerList(page_num, per_page, strWhere);
                if (lst != null && lst.Count > 0)
                {
                    JavaScriptSerializer jss = new JavaScriptSerializer();
                    jss.Serialize(lst, sb);
                }
                sb.AppendFormat(","cnt_whole":{0}}}", count);
                //return sb.ToString();
                HttpContext.Current.Response.Write(sb.ToString());
                HttpContext.Current.Response.End();
            }

    ps:当前项目使用的时候,修改了网上下载的jquery.ajaxComboBox.7.1.js,

    改动位置:69,87行,文件路径,1293 匹配正则,1302自动完成匹配字段,1827行赋值到其它文本框。

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    poj 3590 The shuffle Problem——DP+置换
    poj 3128 Leonardo's Notebook——思路(置换)
    bzoj 1004 [HNOI2008]Cards && poj 2409 Let it Bead ——置换群
    bzoj 1119 [POI2009]SLO && bzoj 1697 [Usaco2007 Feb]Cow Sorting牛排序——思路(置换)
    bzoj 3944 Sum —— 杜教筛
    bzoj 1367 [ Baltic 2004 ] sequence —— 左偏树
    bzoj 2093 [ Poi 2010 ] Frog —— 滑动窗口 + 倍增
    bzoj 2276 [ Poi 2011 ] Temperature —— 单调队列
    bzoj 2069 [ POI 2004 ] ZAW —— 多起点最短路 + 二进制划分
    NOIP2007普及 守望者的逃离
  • 原文地址:https://www.cnblogs.com/ful1021/p/4804440.html
Copyright © 2020-2023  润新知