表格可见,看起来不错,列标题出现,但在“处理中,请稍候...”的瞬间后,状态变为“无项目”。检查 DOM 中的响应显示数据正在从 Web 服务正确返回,格式如下:
<?xml version="1.0" encoding="utf-8"?>
<MyDataClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<Page>1</Page>
<Rows>
<MyDataRow>
<request_id>13073</request_id>
<status>501</status>
<req_by_user_id>herbjm</req_by_user_id>
</MyDataRow>
...
....
</Rows>
</MyDataClass>
这是有问题的flexigrid javascript:
$('#report').flexigrid({
url: 'reportdata.asmx/rptPendingServerRequestsFlexi',
dataType: 'xml',
colModel: [
{ display: 'ID', name: 'request_id', width: 40, sortable: true, align: 'center' },
{ display: 'Status', name: 'status', width: 180, sortable: true, align: 'left' },
{ display: 'Requested By', name: 'req_by_user_id', width: 120, sortable: true, align: 'left' }
],
searchitems: [
{ display: 'ID', name: 'request_id' },
{ display: 'Status', name: 'status', isdefault: true },
{ display: 'Requested By', name: 'req_by_user_id' }
],
sortname: "request_id",
sortorder: "desc",
usepager: false,
title: 'Server Requests',
useRp: false,
rp: 30,
showTableToggleBtn: false,
singleSelect: true
});
对于奖励积分,即使分页已禁用,我如何显示页脚?
更新:我检查了 DOM 的 flexigrid 演示,这里是他们返回的 XML 的格式:
<?xml version="1.0" encoding="utf-8"?>
<rows>
<page>1</page>
<total>239</total>
<row id='1'>
<cell>1</cell>
<cell>501</cell>
<cell>Steve</cell>
</row>
<row id='2'>
<cell>2</cell>
<cell>501</cell>
<cell>Fred</cell>
</row>
</rows>
我猜这就是为什么它不起作用?要了解我是如何构建响应的,请参阅以下问题:vb.net return json object with multiple types?