:: Forum >> Version 1 >>

PAGING patch and column SORTING (empty lines BUG)


paging patch (patches/paging1.htm) is not compatible with column sorting.

with the paging patch installed and a dataset loaded in the grid spanning more than one page, try to sort by one column and then load another dataset (request of xml data, in my case).

is seems to "remember" previous row/values and row/order,
so that empty and blank lines are shown,
expecially if first query has more rows than second.

this is my implementation of the goToPage method,
where the comment block contains some of tries i did.

var iPagingRowPerPage 50// a variable declared elsewhere


  
function goToPage(delta_inbFirstRefresh_in) {
    var 
iPageNumberTmp objGrid.getProperty("row/pageNumber");
    var 
iPageCountTmp objGrid.getProperty("row/pageCount");
    var 
iPageNumberCurrentTmp iPageNumberTmp;
    
iPageNumberTmp += delta_in;
    if (
iPageNumberTmp 0) { iPageNumberTmp 0; }
    if (
iPageNumberTmp iPageCountTmp 1) { iPageNumberTmp iPageCountTmp 1; }
    var 
iRecordCountTmp tableGrid.getProperty("count");
    if (
iRecordCountTmp 0) {
      
objGrid.setProperty("row/pageSize"iPagingRowPerPage);
    } else {
      
// negative row-header numbers bug solution
      
objGrid.setProperty("row/pageSize"0);
    }

    
// display label
    
var iRecordFromTmp = (iPagingRowPerPage iPageNumberTmp) + 1;
    var 
iRecordToTmp iPagingRowPerPage * (iPageNumberTmp 1);
    if (
iRecordToTmp iRecordCountTmp) { iRecordToTmp iRecordCountTmp; }
    
document.getElementById("labelGridPagingPages").innerHTML "Page " + (iPageNumberTmp 1) + " of " iPageCountTmp;
    
document.getElementById("labelGridPagingRecords").innerHTML "(record " iRecordFromTmp "-" iRecordToTmp " of " iRecordCountTmp ")";

if (
bFirstRefresh_in === true) {

objGrid.setSortProperty("index"null);
//objGrid.sort(-1, "ascending");

/*

var iNewCountTmp = objGrid.getDataProperty("count");
if (iNewCountTmp > iPagingRowPerPage) {
  iNewCountTmp = iPagingRowPerPage;
}
var arrayRowValuesNewTmp = [];
for (var i = 0; i < iNewCountTmp; i++) { arrayRowValuesNewTmp[i] = i; }
//for (var i = 0; i < iPagingRowPerPage; i++) { arrayRowValuesNewTmp[i] = i; }
//alert(arrayRowValuesNewTmp);

var arrayRowValuesTmp = objGrid.getRowProperty("values");
alert(arrayRowValuesTmp);

//  objGrid.setRowProperty("order", function(i) { return i });
//  objGrid.setRowProperty("values", arrayRowValuesTmp);
  objGrid.setRowProperty("values", arrayRowValuesNewTmp);
objGrid.setSortProperty("index", null);


*/
}

    if (
iPageNumberCurrentTmp == iPageNumberTmp) { return; }
    
objGrid.setProperty("row/pageNumber"iPageNumberTmp);
    
objGrid.refresh();
  }
 
any solution?

what about a grid reset (paging, sort, counts, all)?

comments will be appreciated,
thanks.
mirko
Friday, July 15, 2005



This topic is archived.

Back to support forum

Forum search