加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

easyUI中的datagrid的formatter方法中 使用$.ajax()方法绑定多个

发布时间:2020-12-16 01:52:11 所属栏目:百科 来源:网络整理
导读:1.datagrid 数据源 绑定url: 'data/GetJson.aspx', 2.userRole_id列,显示userRole;userRole的数据源绑定不来自url: 'data/GetJson.aspx',而是来自htmlobj=$.ajax({type:'post',url:'data/GetUserRole.aspx/',data:{userRole_id:value},async:false}); 3.da

1.datagrid 数据源 绑定url: 'data/GetJson.aspx',

2.userRole_id列,显示userRole;userRole的数据源绑定不来自url: 'data/GetJson.aspx',而是来自htmlobj=$.ajax({type:'post',url:'data/GetUserRole.aspx/',data:{userRole_id:value},async:false});

3.datagrid 应用 formatter:function(value,row){
htmlobj=$.ajax({type:'post',async:false});
return htmlobj.responseText;}

例子

<table id="dg" class="easyui-datagrid" title="Row Editing in DataGrid" style="width: 700px;

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
}

}"

>

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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读