0

我正在使用 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>

我通读了我找到的文档,我没有看到任何限制。有人对此有任何想法吗?

非常感谢任何输入。

4

1 回答 1

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 中的对象被包装在一个数组中?

问候, 凯特

于 2015-03-11T19:57:01.903 回答