• 绑定Ligerui中的ligerComboBox二级联动


     $.ajax({
                    url: "HRHandler.ashx",
                    data: "bz=getDepartData",
                    cache: false,
                    type: "post",
                    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                    success: function (data) {
                        if (data != null) {
                            //生成类型 下拉必须是jason字符串
                            var selectdata = eval(data);
                            t34.setData(selectdata);
                            
                            //for (var i = 0; i < selectdata.length; i++) {
                            //    $("#TextBox34").append("<option value='" + selectdata[i].id + "'>" + selectdata[i].text + "</option>");
                            //}
                        }
                    },
                    error: function () {
                        f_alert('fail', 'error')
                    }
                });
                //当选择部门的时候加载二级班组,构成联动
                $("#TextBox34").change(function() {
                    var departId = "";
                    $("#TextBox34").ligerComboBox({  boxwidth ,
                        onSelected: function (newvalue)
                        {
                            departId = newvalue;
    
                            $.ajax({
                                url: "HRHandler.ashx",
                                data: "bz=getGroupData&departId=" + departId,
                                cache: false,
                                type: "post",
                                contentType: "application/x-www-form-urlencoded; charset=UTF-8",
                                success: function (data) {
                                    var a = "[ {'id':' ','text':' '}]";
                                    t35.setData(eval(a));
                                    
                                    var selectdata = eval(data);
                                    t35.setData(selectdata);
                                },
                                error: function () {
                                }
                            })
                        }
                    });
                });
         //联动加载部门数据到dropdownlist
                case "getDepartData":
                    DataTable dt = EDU.DBUtility.DbHelperSQL.GetDataTable("select departed_I,departName_N from DepartmentEng");
                    //StringBuilder st = new StringBuilder();
                    //foreach (DataRow dr in dt.Rows)
                    //{
                    //    st.Append("<option value="" + dr["departed_I"].ToString() + "">" + dr["departName_N"].ToString() + "</option>
    ");   
                    //}
    
                   string griddata = EDU.COMMON.PublicMethod.GetSelectJson(dt);
                   griddata = griddata.Replace("departName_N", "text");
                   griddata = griddata.Replace("departed_I", "id");
                    
                   context.Response.Write(griddata);
                    break;
    
                //联动加载部门下的班组数据到dropdownlist
                case "getGroupData":
                    DataTable dtGroup = EDU.DBUtility.DbHelperSQL.GetDataTable("select G.group_I,G.groupName_N from [GroupsEng] G left join [DepartmentEng] D on G.departid_I=D.departed_I where D.departed_I=" + context.Request.Params["departId"]);
                    //StringBuilder stGroup = new StringBuilder();
                    //foreach (DataRow dr in dtGroup.Rows)
                    //{
                    //    stGroup.Append("<option value="" + dr["group_I"].ToString() + "">" + dr["groupName_N"].ToString() + "</option>
    ");
                    //}
                    //context.Response.Write(stGroup.ToString());
    
                    string griddataG = EDU.COMMON.PublicMethod.GetSelectJson(dtGroup);
                    griddataG = griddataG.Replace("groupName_N", "text");
                    griddataG = griddataG.Replace("group_I", "id");
    
                    context.Response.Write(griddataG);
                    break;
  • 相关阅读:
    echo "不允许上传该类型的文件
    php构造函数,引入数据库操作类函数
    php函数描述及例子
    php如何判断远程文件是否存在
    多线程面试题系列(16):多线程十大经典案例之一 双线程读写队列数据
    多线程面试题系列(15):关键段,事件,互斥量,信号量的“遗弃”问题
    多线程面试题系列(14):读者写者问题继 读写锁SRWLock
    多线程面试体系列(13):多线程同步内功心法——PV操作下
    多线程面试题系列(12):多线程同步内功心法——PV操作上
    多线程面试题系列(11):读者写者问题
  • 原文地址:https://www.cnblogs.com/kennyliu/p/3977525.html
Copyright © 2020-2023  润新知