1.datagrid 数据源 绑定url: 'data/GetJson.aspx',@H_403_1@
2.userRole_id列,显示userRole;userRole的数据源绑定不来自url: 'data/GetJson.aspx',而是来自htmlobj=$.ajax({type:'post',url:'data/GetUserRole.aspx/',data:{userRole_id:value},async:false}); @H_403_1@
3.datagrid 应用 formatter:function(value,row){
htmlobj=$.ajax({type:'post',async:false});
return htmlobj.responseText;}@H_403_1@
例子@H_403_1@
<table id="dg" class="easyui-datagrid" title="Row Editing in DataGrid" style="width: 700px;@H_403_1@ height: auto" data-options="
iconCls: 'icon-edit',
singleSelect: true,
toolbar: '#tb',
url: 'data/GetJson.aspx',//datagrid绑定的主要数据源
method: 'get',
onClickRow: onClickRow
">
<thead>
<tr>
<th data-options="field:'user_id',width:80">
user_id
</th>
<th data-options="field:'userRole_id',width:100,
formatter:function(value,row){
htmlobj=$.ajax({type:'post',async:false}); // 获取userrole的值 显示在该列中
return htmlobj.responseText;
},
editor:{
type:'comboBox',
options:{
valueField:'userRole_id',
textField:'userRole',
method:'get',
url:'data/GetRoleJson.aspx',
required:true
}
}"@H_403_1@
>@H_403_1@ role </th> <th data-options="field:'user_name',width:80,align:'right',editor:'textBox'"> name </th> <th data-options="field:'user_pass',editor:'numberBox'"> password </th> <th data-options="field:'dept_name',width:250,editor:'textBox'"> department </th> </tr> </thead> </table> 原文链接:https://www.f2er.com/ajax/162935.html