我使用shieldui的网格来显示一些数据。如果只有一个数据节点,则表格会显示并显示“没有要显示的数据”。如果有两个或更多结果,则显示正常。这是我用来显示数据的代码 -
$('.data-holder').shieldGrid({
dataSource: {
data: jsonFromXML.HistoricalQuotes.HistoricalQuote
}
});
如下所示的多节点xml显示得很好 -
<IRXML CorpMasterID="xxxxx">
<HistoricalQuotes Ticker="xxx" Date="03/03/1992">
<HistoricalQuote>
<Bid>0</Bid>
<Ask>0</Ask>
<High>28.1643892082794</High>
<Low>27.7277320112518</Low>
<Volume>583524.1048</Volume>
<Open>27.8368963105087</Open>
<SharesOutstanding>0</SharesOutstanding>
<Last>28.1643892082794</Last>
<AdjustmentFactor>1.145063</AdjustmentFactor>
<RollingEarnings>0</RollingEarnings>
<ShortInterest>0</ShortInterest>
</HistoricalQuote>
<HistoricalQuote>
<Bid>0</Bid>
<Ask>0</Ask>
<High>28.1643892082794</High>
<Low>27.7277320112518</Low>
<Volume>583524.1048</Volume>
<Open>27.8368963105087</Open>
<SharesOutstanding>0</SharesOutstanding>
<Last>28.1643892082794</Last>
<AdjustmentFactor>1.145063</AdjustmentFactor>
<RollingEarnings>0</RollingEarnings>
<ShortInterest>0</ShortInterest>
</HistoricalQuote>
</HistoricalQuotes>
</IRXML>
但是,如果我返回这样的单个数据节点,我会得到'没有记录显示消息' -
<IRXML CorpMasterID="xxxxx">
<HistoricalQuotes Ticker="xxx" Date="03/03/1992">
<HistoricalQuote>
<Bid>0</Bid>
<Ask>0</Ask>
<High>28.1643892082794</High>
<Low>27.7277320112518</Low>
<Volume>583524.1048</Volume>
<Open>27.8368963105087</Open>
<SharesOutstanding>0</SharesOutstanding>
<Last>28.1643892082794</Last>
<AdjustmentFactor>1.145063</AdjustmentFactor>
<RollingEarnings>0</RollingEarnings>
<ShortInterest>0</ShortInterest>
</HistoricalQuote>
</HistoricalQuotes>
</IRXML>
我阅读了我发现的文档,但我没有看到任何限制。有没有人对此有任何想法?
非常感谢任何输入。
答案 0 :(得分:1)
我试图重现所描述的问题,但无济于事。在我身边将网格绑定到单个对象显示它并且没有“没有记录显示消息”。我的设置是:
var products = [{
ProductID: 1,
ProductName: "Chai",
SupplierID: 1,
CategoryID: 1,
QuantityPerUnit: "10 boxes x 20 bags",
UnitPrice: 18.0000,
UnitsInStock: 39,
UnitsOnOrder: 0,
ReorderLevel: 10,
Discontinued: false
}];
$("#grid1").shieldGrid({
dataSource: {
data: products
},
columns: [
{ field: "ProductName", title: "ProductName", width: "330px" },
{ field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
{ field: "UnitsInStock", title: "Units In Stock", width: "130px" },
{ field: "Discontinued", width: "130px" }
]
});
你的设置是什么?你也可以确认jsonFromXML.HistoricalQuotes.HistoricalQuote包含一条记录吗?另请注意,此记录需要在我的示例中的json数组中。你能否确认当xml包含一条记录时,jsonFromXML.HistoricalQuotes.HistoricalQuote中的对象被包装在一个数组中?
此致 吉