easyUI中的datagrid的formatter方法中 使用$.ajax()方法绑定多个
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){ 例子 <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>(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |