jQuery MiniUI
标题:
ComboBox联动选择
[打印本页]
作者:
aiziyou
时间:
2013-5-12 12:39:04
标题:
ComboBox联动选择
本帖最后由 aiziyou 于 2013-5-12 12:42 编辑
我是个刚接触框架的用户,有个问题是要弄个 ComboBox联动选择,选择项是从数据表中调用。我看了ComboBox联动选择的Demo。感觉是不是根本没有实现????
下面是代码。
可以看到最后
AjaxService.php只用print_r($json)输出了字符串。。并没有绑定combobox。而且会有提示错误。。。
[attach]1851[/attach]
<input id="deptCombo" class="mini-combobox" style="width:150px;" textField="name" valueField="id"
onvaluechanged="onDeptChanged" url="../data/AjaxService.php?method=GetDepartments"
showNullItem="true"
/>
public function GetDepartments(){
$myconn = createDB();
$sql = "select a.* from t_department a";
$result=mysql_query($sql,$myconn);
$data = array();
while($row=mysql_fetch_array($result))
{
array_push($data,$row);
}
return $data;
}
function GetDepartments(){
require_once('TestDB.php');
$testDB = new TestDB();
$data = $testDB->GetDepartments();
$json = json_encode($data);
print_r($json);
};
复制代码
作者:
factory
时间:
2013-5-13 09:26:25
绑定数据的话,后台返回一个json的字符串就可以了
combobox的结构是这样的
[
{id:"1",text:"a"},
{id:"2",text:"b"}
]
欢迎光临 jQuery MiniUI (http://miniui.com/discuss/)
Powered by Discuz! X2