2013-04-08 42 views
0

我無法理解dataTables拒絕顯示單行數據的原因,但對於任何大於1行的數據集,它都能正常工作。我不認爲這也顯示了問題,因爲我認爲這是錯誤的JSON消息的格式在這裏或根據我的視圖過濾器不工作,所以.....直接它將然後條件並返回值從DBTABLE如何在json中顯示數組,當我的表包含單個記錄時

這是一個10記錄JSON應答,其工作原理確定:

<sequence xmlns="http://ws.apache.org/ns/synapse" name="Getmessage_seq" onError="fault" trace="disable"> 
    <property name="CONTENT_TYPE" value="application/json" scope="axis2" type="STRING"/> 
    <filter xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" xpath="s://logid/text()=' '"> 
     <then> 
     <payloadFactory> 
      <format> 
       <ResponseJSON xmlns=""> 
        <Exception>NO Data Found In Database</Exception> 
        <Status>404</Status> 
       </ResponseJSON> 
      </format> 
     </payloadFactory> 
     <send/> 
     </then> 
     <else> 
     <property name="AAR" expression="count(//s:Datalist)" scope="default" type="STRING"/> 
     <enrich> 
      <source clone="true" type="custom" xpath="//s:Datalist"/> 
      <target action="replace" type="property" property="List"/> 
     </enrich> 
     <property name="CONTENT_TYPE" value="application/json" scope="axis2"/> 
     <payloadFactory> 
      <format> 
       <ResponseJSON xmlns=""> 
        <Body>$1</Body> 
        <Status>200</Status> 
        <Total>$2</Total> 
       </ResponseJSON> 
      </format> 
      <args> 
       <arg expression="get-property('List')"/> 
       <arg expression="get-property('AAR')"/> 
      </args> 
     </payloadFactory> 
     <send/> 
     </else> 
    </filter> 
</sequence> 

enter code here

最後,當我的表包含多個記錄數據被示出爲在JSON陣列,當它轉向一個記錄數據不會在json中顯示爲數組。

+0

我沒有收到任何答案,無論是在wso2 esb中的錯誤 – user1983299 2013-04-09 06:44:48

回答

0

你可以將你的單個元素包裝在一個數組中,以便兩個響應具有相同的結構。 $ myVar = array('recordSet'=> $ this-> myRecord [0]);

+0

我無法弄清楚這一點,我應該把這個東西放在哪裏...... – user1983299 2013-04-10 05:49:55

相關問題