Browse Source

Merged:

Fix for #2864 - Added server side checks for currentPageFirstItemId & currentPageFirstItemIndex validity

svn changeset:7535/svn branch:6.0
tags/6.7.0.beta1
Artur Signell 15 years ago
parent
commit
19ad7df367
1 changed files with 32 additions and 5 deletions
  1. 32
    5
      src/com/itmill/toolkit/ui/Table.java

+ 32
- 5
src/com/itmill/toolkit/ui/Table.java View File

@@ -822,8 +822,23 @@ public class Table extends AbstractSelect implements Action.Container,
}
}

// If the search for item index was successfull
// If the search for item index was successful
if (index >= 0) {
/*
* The table is not capable of displaying an item in the container
* as the first if there are not enough items following the selected
* item so the whole table (pagelength) is filled.
*/
int maxIndex = size() - pageLength;
if (maxIndex < 0) {
maxIndex = 0;
}

if (index > maxIndex) {
setCurrentPageFirstItemIndex(maxIndex);
return;
}

this.currentPageFirstItemId = currentPageFirstItemId;
currentPageFirstItemIndex = index;
}
@@ -1087,14 +1102,26 @@ public class Table extends AbstractSelect implements Action.Container,

private void setCurrentPageFirstItemIndex(int newIndex,
boolean needsPageBufferReset) {
// Ensures that the new value is valid
if (newIndex >= size()) {
newIndex = size() - pageLength;
}

if (newIndex < 0) {
newIndex = 0;
}

/*
* The table is not capable of displaying an item in the container as
* the first if there are not enough items following the selected item
* so the whole table (pagelength) is filled.
*/
int maxIndex = size() - pageLength;
if (maxIndex < 0) {
maxIndex = 0;
}

// Ensures that the new value is valid
if (newIndex > maxIndex) {
newIndex = maxIndex;
}

// Refresh first item id
if (items instanceof Container.Indexed) {
try {

Loading…
Cancel
Save