easyui combobox 赋值,取值,默认选中。

             //赋值(多选下拉框选中)          

            $('#tvType').combobox('setValues',值.split(',')); 

            //取值(多选下拉框选中)

           $("#originalCountry").combobox('getValues');

            //取值(单选下拉框选中)

            //valueField和textField同一属性值。$('#programType').combobox('getValue')获取的值为textField值。

          //  默认选中(单选下拉框)

          $('#upType').combobox('select',‘值’);

            var re = $ht.form.ajaxS(ctx + "/common/fetchProgramType",null,"json");
            if(re =="noRight"){
                return;
            }
            var typeList = new Array();
            typeList.push({ "type":"-1", "type": "全部" });
            if(re.programList!=null&&re.programList!='null'){
                  typeList.push.apply(typeList,re.programList);
            }
            $("#programType").combobox({
                data:typeList,
                valueField:'type',
                textField:'type'
            });
            $('#programType').combobox('select', typeList[0].type);

           var programtype = $('#programType').combobox('getValue');
           if(programtype=='全部'){
              programtype=-1;
            }

            // 播放设置(方式一:默认选中)
              var d = {dictType:"playFlg"};
              var r = $ht.form.ajaxS(ctx + "/common/fetchDictByDictType",d,"json");
              if(r=="noRight"){
                  return;
              }
              var defList = new Array();
              
              if(r.dictList!=null&&r.dictList!='null'&&r.dictList!=''){
                  defList.push.apply(defList,r.dictList);
              }else{
                  defList.push({ "dictCode":"0", "dictName": "暂无" });
              }
              var defvalue="";
              if(re.program.playFlg!=null&&re.program.playFlg!=""){
                  defvalue=re.program.playFlg;
              }else{
                  defvalue=defList[0].dictCode;
              }
              $("#playFlg").combobox({
                  data:defList,
                  valueField:'dictCode',
                  textField:'dictName',
                  value:defvalue

              });

//onselect事件赋给id是name的文本框当前下拉框选中的文本值

 $("#relationId").combobox({
             onSelect:function(record){
                 $('#name').val(record.name);   // name下拉框的显示的名称
             }
          });

//class属性是"easyui-textbox",赋值用$("#launcherName").textbox('setValue','值');

<input id="launcherName" name="launcherName" maxlength="64" class="easyui-textbox" />

===================各位路过的美女帅哥,扫码领红包呦=========================

猜你喜欢

转载自blog.csdn.net/world_the_begin/article/details/48782405
今日推荐