[Editable Table Paging] Editable Table Paging (Aggregate) - Little bug

[Editable Table Paging] Editable Table Paging (Aggregate) - Little bug

  
Forge Component
(1)
Published on 9 Oct by Daryl Van Johnson
1 vote
Published on 9 Oct by Daryl Van Johnson

Hello,

I found a bug in the "Editable Table Paging (Aggregate)" application that I would like to report.
Suppose you have a list with 21 records and the number of records per page equal to 20. As soon as you start the page if you click the "end" button, the record number in the list should be 1, however 20 are listed. If you then click the "start" button, only 1 record is listed. I'm trying to fix the bug but if anyone can help it will be great.

greetings

Carlos Messias wrote:

Hello,

I found a bug in the "Editable Table Paging (Aggregate)" application that I would like to report.
Suppose you have a list with 21 records and the number of records per page equal to 20. As soon as you start the page if you click the "end" button, the record number in the list should be 1, however 20 are listed. If you then click the "start" button, only 1 record is listed. I'm trying to fix the bug but if anyone can help it will be great.

greetings

Hi Carlos,

Thank you for bringing this to my attention. Do things function correctly when you increment the page one at a time? I will take a look at the code and see if I can resolve it. It sounds to me like somewhere I have a condition for ‘greater-than’ one in the logic that probably should be a ‘greater-than-or-equal-to’ one condition. Investigate along those lines and I’ll let you know what I come up with. 


Hi Daryl

I believe that in the NextAndPrevious server action, the "Go to End" assignment of the RecordPointer variable, should be changed to "TableLength- (Abs (TableLength / RecordQtyPerPage) * RecordQtyPerPage)". Currently is TableLength- (RecordQtyPerPage * 2).

Regards


Hi Carlos,

It's been a while since I've looked at this code, but the instant I popped in there, I realized that it is functioning as I designed it to (good or bad! lol!). When the 'Go-to-end' action is fired, it calculates and displays a full last page. Firing the 'Next' action all the way to the end functions as you are expecting the 'Go-to-end' action perform. Not sure why I decided to do it like that instead of just mathematically computing what clicking 'Next' at the end of the list would display. Temporary insanity maybe? :-) 

For the sake of consistency, I'm gonna take a look at your suggestion. If it works ok, I'm going to incorporate it and upload a new release to the Forge, giving you credit for the modification of course! :-) I'm probably gonna create a session variable to make changing the RecordQtyPerPage easier. 

Thanks for the input! 

Dvj

Daryl Van Johnson wrote:

Hi Carlos,

It's been a while since I've looked at this code, but the instant I popped in there, I realized that it is functioning as I designed it to (good or bad! lol!). When the 'Go-to-end' action is fired, it calculates and displays a full last page. Firing the 'Next' action all the way to the end functions as you are expecting the 'Go-to-end' action perform. Not sure why I decided to do it like that instead of just mathematically computing what clicking 'Next' at the end of the list would display. Temporary insanity maybe? :-) 

For the sake of consistency, I'm gonna take a look at your suggestion. If it works ok, I'm going to incorporate it and upload a new release to the Forge, giving you credit for the modification of course! :-) I'm probably gonna create a session variable to make changing the RecordQtyPerPage easier. 

Thanks for the input! 

Dvj

Hi Daryl,

I think I've been able to fix the bug.
In the server action "NextAndPrevious" I made the following changes:
"Go to End" -> RecordPointer = (RecordQtyPerPage * (Abs (TableLength / RecordQtyPerPage) -1))
"Set Page Values" -> RecordEnd = If ((RecordBegin + RecordQtyPerPage) - 1 <TableLength, (RecordBegin + RecordQtyPerPage) - 1, TableLength)

greetings


Carlos Messias wrote:

Daryl Van Johnson wrote:

Hi Carlos,

It's been a while since I've looked at this code, but the instant I popped in there, I realized that it is functioning as I designed it to (good or bad! lol!). When the 'Go-to-end' action is fired, it calculates and displays a full last page. Firing the 'Next' action all the way to the end functions as you are expecting the 'Go-to-end' action perform. Not sure why I decided to do it like that instead of just mathematically computing what clicking 'Next' at the end of the list would display. Temporary insanity maybe? :-) 

For the sake of consistency, I'm gonna take a look at your suggestion. If it works ok, I'm going to incorporate it and upload a new release to the Forge, giving you credit for the modification of course! :-) I'm probably gonna create a session variable to make changing the RecordQtyPerPage easier. 

Thanks for the input! 

Dvj

Hi Daryl,

I think I've been able to fix the bug.
In the server action "NextAndPrevious" I made the following changes:
"Go to End" -> RecordPointer = (RecordQtyPerPage * (Abs (TableLength / RecordQtyPerPage) -1))
"Set Page Values" -> RecordEnd = If ((RecordBegin + RecordQtyPerPage) - 1 <TableLength, (RecordBegin + RecordQtyPerPage) - 1, TableLength)

greetings


Hey Carlos,

Your suggestion was on the right track, but it didn't quite work for me as expected. I think I may have resolved the issue. First of all, you'll notice that I changed the 'RecordQtyPerPage' variable to a session variable to make changing it easier. In the 'Go To End' assignment, I set the 'RecordPointer' variable to '(TableLength - Mod(TableLength, Session.RecordQtyPerPage)) - Session.RecordQtyPerPage'. In the 'Set Page Values' assignment, I set the 'RecordEnd' variable to 'If((RecordBegin+Session.RecordQtyPerPage) - 1 > TableLength, TableLength, (RecordBegin+Session.RecordQtyPerPage) - 1)'.

Make these changes in your application and let me know if they work for you. If they work for you, I will update the Forge with the changes.

Thanks man!

Dvj



Of course I'll test. But what went wrong with my suggestion? Everything worked perfectly with me.
Actually the value "Abs (TableLength / RecordQtyPerPage) -1" is in a local variable.

greetings

Solution

For some reason, using Abs() in the expression wouldn't function properly. I wrote it to use Mod() instead. Could have just been something I overlooked, but just refused to play nice.


Dvj

Solution