2017-08-10 95 views
0

Output looks like this ---------- 嗨, 我使用JQuerybootgrid顯示幾百條記錄。我從服務器端返回一個rowCount=10,但它不工作,並繼續顯示所有行。JQuery的Bootgrid rowCount時不起作用

我的來源是這樣的: HTML:

<th data-column-id='ItemID' data-type='numeric' data-identifier='true'>ID</th>"+ 
           "<th data-column-id='ItemNumber'>Item Number</th>"+ 
           "<th data-column-id='ItemDescription'>Description</th>"+ 
           "<th data-column-id='ItemStatus'>Status</th>"+ 
           "<th data-column-id='DateReceived'>Received Date</th>"+ 
           "<th data-column-id='ItemNotes' data-formatter='text' data-sortable='false'>Text Description</th>"+ 
           //"<th data-column-id='NoOfItems' data-formatter='select' data-sortable='false'>No. of Items</th>"+ 
           "<th data-column-id='commands' data-formatter='commands' data-sortable='false'>Actions</th>"; 

Ajax Request: 
current "1" 
rowCount "10" 
searchPhrase "" 

Ajax Response: 
current 1 
rowCount 10 
rows [12] 
0 Object 
1 Object 
2 Object 
3 Object 
4 Object 
5 Object 
6 Object 
7 Object 
8 Object 
9 Object 
10 Object 
11 Object 
total 12 

任何幫助將不勝感激。謝謝

回答

1

起初,這讓很多人感到困惑,就像它一樣。

重要的是要記住,由JQ-BG完成的分頁是而不是。它由服務器完成。 JQ-BG只告訴服務器用戶正在請求什麼頁面,並且詳細信息如每頁的行數,搜索字符串,排序列等等。服務器先由搜索字符串進行篩選(如果適用),根據排序列,然後然後做關於結果集中哪些行構成用戶請求的頁面的數學。最後,服務器發送不超過一頁的價值的行。服務器還反饋總共可用的頁面,以便JQ-BG可以將平鋪的頁碼排列在底部供用戶點擊。

最終,這是有道理的,因爲無論數據的大小如何,它都不會通過一個巨大的事務在有線網絡上發送,這在某種程度上會壓倒瀏覽器並使網絡「慢」。

但是,它確實會產生一些挑戰,例如臨時存儲經過Ajax請求的過濾排序數據並在緩存結果中執行分頁。