We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Server-side grouping and virtualization

Thread ID:

Created:

Updated:

Platform:

Replies:

139289 Jul 13,2016 04:34 AM Aug 16,2018 08:09 AM JavaScript - EJ 2 3
loading
Tags: Grid
Petr Langer
Asked On July 13, 2016 04:34 AM

Hello,
I am evaluating ejGrid and my customer's required functionality is:
- grid in virtual mode
- all operations like sorting, grouping, paging provided server-side (custom WebSocket based communication layer connected to DataManager)
- grouping:
   - at the beginning, list of all groups is read and displayed collapsed (server-side prepared list of groups with record count for each group and total record count), without "leafs" (records)
      - they would like to have even the list of groups being virtualized, but I cannot image how it would be done and how server-side data access would be handled
   - when group is expanded, records are loaded in virtual mode as the user scrolls

Similiar way, they require it for ejTreeGrid. As they expect millions of rows, maximal virtualization support for any tree level is requested.

If  the required functionality is not possible natively by the components, is there a way I could handle some events or override some methods (ejGrid, ejTreeGrid, DataManager) to achive that?
If I'm able to react on expanding, collapsing, scrolling, I can imagine the goal could be reached.

Thank you,
  Petr Langer


Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On July 14, 2016 08:22 AM

Hi Petr, 

Query #1: Virtualization with Grouping, Sorting, paging functionality in ejGrid. 

We have provided only limited support to virtual scrolling method. Grouping support is not available with the Virtual Scrolling enabled ejGrid. We already logged a feature request on this and created a new support incident under your account to track this feature. Please log on to our support website to check for further updates. 


To handle large records and avoid serialization problem, we have provided UrlAdaptor in ej.DataManager, which will populate the current page records in Grid based on the skip and take parameters of this adaptor. Enable allowPaging in Grid to utilize this load on demand concepts in the Grid using UrlAdaptor. Refer to the following code example and Help Documents. 
  
<div id="Grid"></div> 
 
 
<script type="text/javascript"> 
    $(function () { 
        var dataManager = ej.DataManager({ 
            url: "/Home/DataSource", 
            adaptor: new ej.UrlAdaptor(), 
        }); 
        $("#Grid").ejGrid({ 
            dataSource: dataManager, 
            allowPaging: true, 
            allowGrouping: true, 
            allowSorting: true, 
            allowFiltering: true, 
            columns: [ 
                { field: "OrderID", isPrimaryKey: true },  
                    . .   
            ] 
        }); 
    }); 
</script> 
 
        public ActionResult DataSource(DataManager dm) 
        { 
            IEnumerable result = null; 
            int count = 0; 
            IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
            DataOperations operation = new DataOperations(); 
            if (dm.Where != null) 
                DataSource = operation.PerformWhereFilter(DataSource, dm.Where, dm.Where[0].Condition); 
            if (dm.Sorted != null) 
                DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
            count = DataSource.AsQueryable().Count(); 
            if (dm.Skip != null && dm.Skip != 0)//skipped records based 
                DataSource = operation.PerformSkip(DataSource, dm.Skip); 
            if (dm.Take != null && dm.Take != 0)//take needed records. 
                DataSource = operation.PerformTake(DataSource, dm.Take); 
            result = DataSource; 
            return Json(new { result = result, count = count }, JsonRequestBehavior.AllowGet); 
        } 


Note: While using the UrlAdaptor, you have to handle all the Grid actions like Sorting, Filtering, Paging in the server-side, except the Grouping the Action. Grouping Action will be handled at the client-side. Refer to the following KB for Server-side APIs of UrlAdaptor. 


We have also prepared a sample that can be downloaded from the following location. 


Query #2: Similiar way, they require it for ejTreeGrid. As they expect millions of rows, maximal virtualization support for any tree level is requested. 

We have created a separate incident for this query on ejTreeGrid. Please log on to our support website to check for further updates.   


Regards, 
Seeni Sakthi Kumar S. 


Simon
Replied On August 15, 2018 03:23 AM

Hi,

Following on your answer, is it possible not to send the count parameter to the datamanager / grid?

If I have millions of rows in my database on server side, I don't want to use run count = DataSource.AsQueryable().Count() because it will take a lot of time, and it defeats the initial purpose of virtualization.

PS: I'm using Essential J2.

Hariharan J V [Syncfusion]
Replied On August 16, 2018 08:09 AM

Hi Petr, 

Thanks for your update. 

EJ2 Grid Virtualization feature requires total records count in the initial rendering only, because grid scrollable content area will be created based on this count. So without record count detail, virtual scrolling it’s not feasible. 

Regards, 
Hariharan 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;