Skip to content

Infragistics Community Forum / Web / Ignite UI for Angular / Server-Side Paging in IgxGrid With Total Row Count

Server-Side Paging in IgxGrid With Total Row Count

New Discussion
Taher  Hendawi
Taher Hendawi asked on Apr 22, 2021 1:23 PM

Hi all,

I’m new in Ignite UI and I’m trying to apply load on demand feature wenn paging in the igx-grid.

I have a huge dataset, which a fetch from a service so I want to load just 50 rows per Page and when the user clicks next page, should the service fetch the next 50 rows.

The Problem is that the count of pages should be set according to the total count of remote data, NOT according to the loaded data (50 rows).

My Code and the Api are below:

 

Angular Component:

 

  users: User[];
 
  ngOnInit() { );
    this._dataService.getdata(0).subscribe(data => { this.users = data.users; this.count=data.count; console.log(data)});
  }

 pageNext(event) {
    this._dataService.getdata(event.current).subscribe(data => { this.users = data; });
  }

 

 

 

Angular Service:

 

getdata(pageindex):Observable{
  return this._http.post('http://localhost/values/GetUsers',pageindex);
 }

 

 

WebApi:

 

       [HttpPost]
        public object GetUsers([FromBody] int pageIndex)
        {
            int userIndex = pageIndex * 50;
            List users = new List();
            users = _context.Users.ToList();

            users = users.GetRange(userIndex, 50);
            return new { users = users, count = _context.Users.Count() } ;
        }

 

 

View Html:

 

     
            
            

 

 

Sign In to post a reply

Replies

  • 0
    Jerry Jonas
    Jerry Jonas answered on Sep 12, 2018 3:19 PM

    Could you write another part of the service that just gets the count from the server, i.e: return SELECT COUNT(*) FROM ….  then display that somewhere ?

    • 0
      Taher  Hendawi
      Taher Hendawi answered on Sep 12, 2018 5:02 PM

      that's not the point! 

      I have this action in my service too, which gets the count, but when i get that number, it should affect the count of pages in the grid.
      SO, how to let that number change the count of pages in the grid irrespectively the count of its row's count??

      • 0
        Aleksandar Kamenov
        Aleksandar Kamenov answered on Sep 14, 2018 5:55 AM

        Hello Taher,

        We are in the process of building such sample.

        I hope that it is going to be ready today or later on Monday.

        Once we are ready I'm going to provide all the information you would need.

        if you have further questions, please contact us again.

      • 0
        Taher  Hendawi
        Taher Hendawi answered on Sep 18, 2018 9:11 AM

        Hello Aleksandar,

        when can I expect the sample? 

      • 0
        Tihomir Iliev
        Tihomir Iliev answered on Sep 19, 2018 8:43 AM

        Taher,

        Thank you for your patience.

        Here you can find a working sample of what you desire – https://stackblitz.com/edit/igxgrid-remote-chunk-paging.

        Please let us know if you need further assistance.

      • 0
        Michel LAPLANE
        Michel LAPLANE answered on Sep 26, 2018 6:23 AM

        I was needed the same things. 

        I would like to tell it's a very nice sample. it helps me a lot.

        I think some part of this sample could be added to the demo.

        Good work.

      • 0
        Sameer Tanna
        Sameer Tanna answered on Apr 22, 2021 1:23 PM

        Hii the demo is broken on stackblitz, can it be updated?

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Taher Hendawi
Favorites
0
Replies
7
Created On
Apr 22, 2021
Last Post
5 years, 3 months ago

Suggested Discussions

Created by

Created on

Apr 22, 2021 1:23 PM

Last activity on

Feb 12, 2026 9:58 AM