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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid and Binding with DataManager

Thread ID:





131007 Jun 16,2017 02:05 AM UTC Jun 16,2017 09:33 AM UTC ASP.NET Core 1
Tags: Grid
Asked On June 16, 2017 02:05 AM UTC

        public IActionResult GetIndexData([FromBody]DataManager dm)
            var list = _context.Pilots.Skip(dm.Skip).Take(dm.Take).Include(p => p.Union).
                                Include(p => p.Masterlist).Include(p => p.Instructor).ToList();       //Second Trip kills this query because DM is NULLLLLLL

            return Json(new { result = list, count = list.Count });

<ej-grid id="pilotgrid" allow-searching="true" allow-filtering="true" 
                     query="new ej.Query().select(['PilotId', 'FirstName', 'LastName', 'CompanyId', 'PreMergerId', 'Legacy', 'DOB', 'DOH', 'SeparationDate', 'LOAExp', 'StatusCode', 'Notes']).take(50)"
                     allow-grouping="true" show-stacked-header="true" allow-paging="true">
                <e-datamanager id="DataManager" url="/Pilots/GetIndexData" adaptor="@AdaptorType.UrlAdaptor" />

For what ever reason, it must be me since I still have issue most of your tools associated with the failure that is DataManager,  the query specified in the Grid NEVER gets executed beyond  'take(12)' (default)???.  Can you explain this and the bold comment happens.... 

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On June 16, 2017 09:33 AM UTC

Hi Morgan,  
Thanks for contacting Syncfusion Support.  
We could see you would like to populate the Grid in on-demand. In the provided code example, you have returned the count incorrectly, which is the cause of the problem. The count must be total records that found in the datasource. Based on the count, paging action will be done. Refer to the following code example. 
<ej-grid id="FlatGrid"  allow-paging="true" 
           query="new ej.Query().select(['ID','CustomerID','EmployeeID'])" 
    <e-datamanager url="/Home/GetIndexData" adaptor="UrlAdaptor" /> 
        . . .  
             . . . 
        public IActionResult GetIndexData([FromBody]DataManager dm) 
            IEnumerable datasource = order; 
            DataOperations operation = new DataOperations(); 
            int count = datasource.AsQueryable().Count(); 
            if (dm.Select != null)//select required columns 
                datasource = operation.PerformSelect(datasource, dm.Select); 
            if (dm.Skip >= 0)//for paging 
                datasource = operation.PerformSkip(datasource, dm.Skip); 
            if (dm.Take > 0)//for paging 
                datasource = operation.PerformTake(datasource, dm.Take); 
            return Json(new { result = datasource, count = count }); 
We have already discussed about the server-end data operations in the following KB.  
 - Initial Load of the Grid 
-          Paging action 
Result must hold 12 records as per the request but the count is total records. 
We have prepared a sample that can be downloaded from the following location.  
If you would like to change the default value of the take (12), you can change the default page-size of the Grid e-page-settings which will alter the take value. Refer to the following code example and Help Documents.  
<ej-grid id="FlatGrid"  allow-paging="true" 
           query="new ej.Query().select(['ID','CustomerID','EmployeeID'])" 
    <e-datamanager url="/Home/GetIndexData" adaptor="UrlAdaptor" /> 
    <e-page-settings page-size ="10"/> 
         . .  
              . .  
Seeni Sakthi Kumar S. 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon