Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
335
Virtual Data
posted

Hello,

I would like to use the "virtual mode" in the igGrid but I also need to retrieve the data to be virtual, retrieving one page at the time.

Is there a way I can override any method in igDataSource to make the data source virtual?

Or, is there a way I can override any method in igGrid (ie. getCellText) to be able to load the data on demand by using my own JavaScript code?

Thanks in advance!

Parents
No Data
Reply
  • 23953
    Offline posted

    Hi John,

    There is no such functionality out of the box currently, but I think it can be easily achieved with a custom  logic.
    Here is my suggestion:
    Create an instance of igDataSource bound to remote url. Configure the data source to use paging.
    Call igDataSource.dataBind() on the data source in order to get the first page. Bind igGrid to that data (use igDataSource.dataView() to get the data from the data source.
    Next you need an interface for the user to load more data to the grid. Let's have a button with caption "Load More Data…".
    Use this button to call the data source igDataSource.nextPage() method. Calling the igDataSource.nextPage() method will request the next chunk of data. Get the data with the igDataSource.dataView() method and add it to the grid my using the igGrid.renderNewRow() method.
    This approach will work for a simple grid scenario, without features. If you need more complex scenario, for example where local filtering and local sorting are used you need to use the data source of the igGrid (which you can get with this code: $("#grid1").data("igGrid").dataSource) and call its addRow() method. Then you need to rebind (call igGrid.dataBind()) the grid in order for reflect the change.

    Hope this helps,
    Martin Pavlov
    Infragistics, Inc.

Children