星空网 > 软件开发 > ASP.net

jquery easyui使用(三)datagrid加载数据(未解决)

<div id="table_Data">    </div>

$("#table_Data").datagrid({  toolbar: '#myToolbar',  url: urlAshx,  queryParams: { "action": "carlist" },  method: 'post',  width: 'auto',  height: '500px',  iconCls: 'icon-edit',  singleSelect: true,  fitColumns: false,  pagination: true,  pageSize: 15,  pageList: [15, 25, 35, 45],  pageNumber: 1,  rownumbers: true,  loadMsg: "正在加载数据...",  columns: [[    { filed: 'ID', title: '编号', width: 120, hidden: true },    { filed: 'Name', title: '车辆名称', width: "120", align: 'center' },    { filed: 'Type', title: '型号', width: 120, align: 'center' },    { filed: 'LicenseTag', title: '牌号', width: 120, align: 'center' },    { filed: 'Color', title: '座位数', width: 120, align: 'center' },    { filed: 'Seats', title: '颜色', width: 120, align: 'center' },    { filed: 'Remarks', title: '备注', width: 920, align: 'center' },    {      filed: 'Action', title: '操作', width: 550, align: 'center', formatter: function (value, row, index) {        alert(row.Name);        var Action = "<a href='javascript:void(0);' onclick='Edit(" + row.ID + ")'>修改</a>\javascript:void(0);' onclick='Delete(" + row.ID + ")'>删除</a>";        return Action;      }    }  ]],  onLoadSuccess: function (data) { alert("success"); },  onLoadError: function (

 

private string GetCarList(HttpContext context){  string result = "";  DataTable dt = bll_cmCar.GetAllList().Tables[0];  if (dt != null && dt.Rows.Count > 0)  {    int total = dt.Rows.Count;    string json = Common.DataTableConvertJson.DataTableToJson(dt);    result = "{\"total\":" + total + ",\"rows\":" + json + "}";    //result = json ;  }  return result;}

 返回的数据格式正确,在IE中报如下错误:

jquery easyui使用(三)datagrid加载数据(未解决)

jquery easyui使用(三)datagrid加载数据(未解决)

给这两个错误加上判断col!=null,倒是不报错了,但是结果还是显示不出来,求大神指教

jquery easyui使用(三)datagrid加载数据(未解决)

替代方案

前端页面:

<table id="table_Data" title=""  data-options="singleSelect:true,collapsible:true,url:'ashx/Car.ashx',method:'post',queryParams: { 'action': 'carlist' },toolbar: '#myToolbar',height: '500px',width: 'auto',iconCls: 'icon-edit',fitColumns: false,pagination: true,pageSize: 15,pageList: [15, 25, 35, 45],pageNumber: 1,rownumbers: true,loadMsg: '正在加载数据...',">  <thead>    <tr>      <th data-options="field:'ID',width:80, hidden: true">ID</th>      <th data-options="field:'Name',width:100,align:'center'">Name</th>      <th data-options="field:'Type',width:80,align:'center'">Type</th>      <th data-options="field:'LicenseTag',width:80,align:'center'">LicenseTag</th>      <th data-options="field:'Color',width:50,align:'center'">Color</th>      <th data-options="field:'Seats',width:60,align:'center'">Seats</th>      <th data-options="field:'Remarks',width:250,align:'center'">Remarks</th>    </tr>  </thead></table>

 




原标题:jquery easyui使用(三)datagrid加载数据(未解决)

关键词:jquery

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流