码迷,mamicode.com
首页 > 其他好文 > 详细

EasyUI Combobox 组合框

时间:2016-07-11 12:28:09      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

默认选择第一项,加请选择,取值问题

<input class="easyui-combobox" id="ddlWHS" name="ddlWHS" />


 //combox默认选择第一个
                        $(function () {
                            $(#ddlWHS).combobox({
                                url: "../../HR/attType/list_attType.ashx?type=Bindddl",
                                valueField: WorkingHour_beginTime,
                                textField: WorkingHour_name,
                                editable: false,
                                onLoadSuccess: function (data) {
                                    var data = $(#ddlWHS).combobox(getData);
                                    if (data.length > 0) {
                                        $("#ddlWHS").combobox(select, data[0].WorkingHour_beginTime);
                                    }
                                }
                            });
                        });

                       //    combox加请选择 
                        $(function () {
                            $(#ddlWHS).combobox({
                                url: "../../HR/attType/list_attType.ashx?type=Bindddl",
                                valueField: WorkingHour_beginTime,
                                textField: WorkingHour_name,
                                editable: false,
                                //返回要显示的过滤数据
                                loadFilter: function (data) {
                                    var o = [{ WorkingHour_beginTime: 0, WorkingHour_name: --请选择--}];
                                    return o.concat(data);
                                },
                                //当远程数据加载成功时触发 
                                onLoadSuccess: function (data) {
                                    var data = $(#ddlWHS).combobox(getData);
                                    if (data.length > 0) {
                                        $("#ddlWHS").combobox(select, data[0].WorkingHour_beginTime);
                                    }
                                },
                                onSelect: function (record) {
                                  //获取values
                                   alert($("#ddlWHS").combobox("getValues"));
                                  // 获取text
                                   alert($("#ddlWHS").combobox("getText"));
                                }

                            });
                        });

 

EasyUI Combobox 组合框

标签:

原文地址:http://www.cnblogs.com/panmy/p/5659591.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!