項目前臺界面使用dhtmlx框架實現,表格用到了dhtmlxgrid, 後臺傳遞數據到前臺時,隨機會出現,界面不斷刷新問題
grid的數據通過後臺返回的xml加載:
mygrid.loadXML("ofmNewRptStagingList?status="+ (saveButtonStatus ? "ro" : "ed"));
感覺很莫名其妙,後臺servelet多次受到請求,但是不知道從哪裏發來的請求,跟了一天,才找到原因:
後臺返回的xml文件:
String result = "<rows
total_count='"+total+"' pos='"+posStart+"'>";
使用下面的循環加載Row
for(int i = 0; i < ofmNewRptList.size(); i++) {
OFMNewRpt s = ofmNewRptList.get(i);
OFMNewRpt m;
if (sizeOfListM > i) {
m = ofmNewRptListM.get(i);
}else {
m = s;
}
result += "<row>";
result += s.generateXmlStr(status, m);
result += "</row>";
}
如果<rows標籤指定的total_count的值與ofmNewRptList.size()不一致,前臺頁面就會不斷髮送請求,直到加載的<row>與total_count的值一致爲止。