Skip to content

Paging uses wrong pageindex #50

@niekvanderreest

Description

@niekvanderreest

Hi,

The MemberExtendedService has a bug in the PerformExamineSearch function, this causes the first page to load when you click "next" or "2" in the pager, and makes the last page inaccessible.

The problem is following code, it already has a pageindex and substracts 1 from is, causing index:0 to be -1 and index 1 to be 0, and so on. I made my own implementation of the servcie and registered it, to confirm that removing the "-1" fixes this problem

if (pageSize > 0)
{
    int skipCount = (pageIndex > 0 && pageSize > 0) ? Convert.ToInt32((pageIndex -1) * pageSize) : 0;
    if (totalRecords < skipCount)
    {
        skipCount = (int)totalRecords / pageSize;
    }

    return results.Skip(skipCount).Take(pageSize);
} 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions