2013-01-06 92 views
0

以下代碼使用jqxgrid插件。我將循環值更改爲400,生成400頁,每頁10頁。尋呼不超過270頁

運行時,我只看到0-26鏈接(對於270頁),而不是0-39鏈接。我該如何解決這個問題?

另一個場景,在我的應用程序中,我只看到380頁的分頁鏈接,而不是900頁。如果有人可以解決,下面我可以在我的應用程序中應用相同的解決方案。非常感謝!


前面的代碼已被修改,使用來自例如:

http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/virtualdata.htm?classic

爲什麼它不顯示的記錄?請解釋。什麼是需要的變化。非常感謝。

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title id='Description'>In this demo jqxGrid uses a virtualized paging which enables you to handle very large data sets without any impact on client side performance.</title> 
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" /> 
    <script type="text/javascript" src="../../scripts/jquery-1.8.2.min.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.pager.js"></script> 
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script> 
    <script type="text/javascript" src="../../scripts/gettheme.js"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      var theme = getTheme(); 
      // prepare the data 
      var data = new Array(); 
      var jsonObject = { "contactList":[ 

{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 
{"age":1,"SId":"S1234567","gender":"male"}, 

], "totalrecords":9}; 

//alert("jsonObject.totalrecords : " + jsonObject.totalrecords); 

      // generate sample data. 
      var generatedata = function (startindex, endindex) { 
       var data = {}; 
       for (var i = startindex; i < endindex; i++) { 

      //alert(startindex + " " + endindex); 
        var row = {}; 

          row["age"] = jsonObject.contactList[i].age; 
          row["gender"] = jsonObject.contactList[i].gender; 
          row["SId"] = jsonObject.contactList[i].SId; 


        data[i] = row; 
       } 
       return data; 
      } 
      var source = 
      { 
       datatype: "array", 
       localdata: {}, 
       totalrecords: jsonObject.totalrecords 
      }; 

      // load virtual data. 
      var rendergridrows = function (params) { 

     alert("rendergridrows : " + source.totalrecords); 
     //alert("rendergridrows : " + params.startindex + " " + params.endindex); 
       var data = generatedata(params.startindex, params.endindex); 
       return data; 
      } 
      var totalcolumnrenderer = function (row, column, cellvalue) { 
       var cellvalue = $.jqx.dataFormat.formatnumber(cellvalue, 'c2'); 
       return '<span style="margin: 6px 3px; font-size: 12px; float: right; font-weight: bold;">' + cellvalue + '</span>'; 
      } 
      var dataAdapter = new $.jqx.dataAdapter(source); 
      $("#jqxgrid").jqxGrid(
      { 
       width: 670, 
       autoheight: true, 
       source: dataAdapter, 
       theme: theme, 
       virtualmode: true, 
       pageable: true, 
       rendergridrows: rendergridrows, 
       columns: [ 

          { text: 'Age', datafield: 'age', width: 50 }, 
          { text: 'SId', datafield: 'SId', width: 120 }, 
          { text: 'Gender', datafield: 'gender', width: 80 }, 

       ] 
      }); 
     }); 
    </script> 
</head> 
<body class='default'> 
    <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;"> 
     <div id="jqxgrid"></div> 
    </div> 
</body> 
</html> 

回答

0

據我看到,從您的代碼中,您爲每個頁面添加錨。我認爲DIV標籤中沒有足夠的空間存在這麼多的標籤。考慮使用不同的佈局,如輸入字段來選擇頁面,如此示例中的百萬條記錄:virtualdata.htm

+0

感謝您的回答。我使用了相同的例子。爲什麼代碼不顯示記錄。 – Zafar

+0

我已根據您的答案修改並重新發布了代碼。請參閱上文。它爲什麼不顯示記錄。 – Zafar

+0

這只是一個通知消息。 – Zafar