EasyUI Forum
May 12, 2024, 02:42:50 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Why select the combobox error when another combobox selected ?  (Read 10247 times)
ejzhang
Jr. Member
**
Posts: 61



View Profile
« on: May 09, 2015, 06:10:04 AM »

I want select combobox named Bureau when the combobox named Station selected, but An error occurred, it is show in attachs.
btw: There is double request when the dialog opened. it is show in attachs.
Code:
<form id="frmRestriction" method="post" action="/restrictions/index.asp?m=Restriction&a=Append" onSubmit="return false;">
<input type="hidden" name="Id" value="" />
<div style="width:100%;padding:3px;text-align:left;margin-left:auto;margin-right:auto;">
<div style="float:left;margin:4px">
<nobr><label>路局</label> <select class="easyui-combobox" name="Bureau" style="width:128px"></select></nobr>
</div>
<div style="float:left;margin:4px">
<nobr><label>到站</label> <select class="easyui-combobox" name="Station" style="width:111px"></select></nobr>
</div><div style="clear:both"></div>
<div style="float:left;margin:4px">
<nobr><label>停装日期</label> <input class="easyui-datebox" name="StartDate" editable="false" style="width:88px" value="2015-05-09" /> <input type="checkbox" name="HasFinishDate" value="1" style="vertical-align:-2px"  onclick="$('[name=FinishDate]').prop('disabled',!this.checked)" /><label>恢复日期</label> <input class="easyui-datebox" name="FinishDate" editable="false" style="width:88px" value="" /></nobr>
</div><div style="clear:both"></div>
<div style="float:left;margin:4px">
<nobr><label>备注</label> <input class="easyui-textbox" name="Notes" value="" data-options="multiline:true,prompt:'最多输入100个字'" style="width:277px;height:88px" /></nobr>
</div>
</div>
</form>
<script type="text/javascript">
<!--
$(function(){
$('[name=FinishDate]').datebox({
onSelect:function(){
$('[name=HasFinishDate]').prop('checked', true);
}
});
$('[name=Bureau]').combobox({
editable:false,
valueField:'Id',
textField:'Name',
url:'/restrictions/index.asp?m=Restriction&a=Bureaus'
});
$('[name=Station]').combobox({
valueField:'Id',
textField:'Name',
mode:'remote',
url:'/restrictions/index.asp?m=Restriction&a=Stations',
prompt:'请输入拼音码或电报码',
delay:500,
onSelect:function(record){
// $('[name=Bureau]').combobox('select', record.Bureau);
}
});
});
//-->
</script>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 09, 2015, 08:54:22 AM »

Please use the id selector to select your combobox components.
Code:
<select class="easyui-combobox" id="Bureau" name="Bureau" style="width:128px"></select>
<script>
$('#Bureau').combobox('select',...);
</script>
Logged
ejzhang
Jr. Member
**
Posts: 61



View Profile
« Reply #2 on: May 09, 2015, 03:37:40 PM »

Why? Is it a bug?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: May 09, 2015, 05:40:30 PM »

It is not a bug, if you really want to use the 'name' attribute selector, please try this:
Code:
$('[comboName=Bureau]').combobox('select', record.Bureau);
Logged
ejzhang
Jr. Member
**
Posts: 61



View Profile
« Reply #4 on: May 10, 2015, 05:12:57 PM »

Thanks a lot! Smiley
Logged
hjzhbb7758
Jr. Member
**
Posts: 84


View Profile Email
« Reply #5 on: May 11, 2015, 07:45:38 PM »

Thanks a lot! Smiley
未定义null .....options..... 什么的错误, 都是jquery  的选择器有问题。跟bug 无关
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!