How to set grid to send query filter string via POST method inside body of request

Hello,

I am using Syncfusion Grid in Angular-2 enviroment and want to include filtering.
Is there a setting for grid, or it's datamanager that tells grid to use post method and send query string in the body of a grid.

Also, does grid have limitation in the lenght of request uri?


3 Replies

DR Dhivya Rajendran Syncfusion Team May 16, 2018 12:51 PM UTC

Hi Jan, 
Thanks for contacting Syncfusion support. 

Query1: I am using Syncfusion Grid in Angular-2 enviroment and want to include filtering. 
 
We have analyzed your requirement and prepared a sample for your reference. In the below sample we have enabled the filtering feature in Grid and handled the filter operation in server side. When you filter the column in Grid the POST request will automatically send to the server.  
 
Kindly refer to the below sample and code example for more information. 
 
[fetchdata.component.html] 
<ejs-grid #grid [dataSource]='data' [allowFiltering] ='true' [allowPaging]='true'> 
    <e-columns> 
        <e-column field='OrderID' headerText='Order ID' isPrimaryKey='true'  width=120></e-column> 
        <e-column field='EmployeeID' headerText='Employee ID' width=150></e-column> 
        <e-column field='CustomerID' headerText='Customer ID' width=150></e-column> 
        . . . . . 
    </e-columns> 
</ejs-grid> 
 
[Homecontroller.cs] 
public IActionResult UrlDatasource([FromBody]Data dm) 
        { 
      var order = OrdersDetails.GetAllRecords(); 
      var Data = order.ToList(); 
      int count = order.Count(); 
      if (dm.where != null && dm.where.Count > 0 && dm.where[0].predicates != null) 
      { 
 
        for (var i = 0; i < dm.where[0].predicates.Count; i++) 
        { 
 
          switch (dm.where[0].predicates[i].field) 
          { 
            case "OrderID": 
              Data = (from cust in Data 
                      where cust.OrderID.ToString() == dm.@where[0].predicates[i].value 
                      select cust).ToList(); 
              break; 
             . . . . . 
         } 
 
          count = Data.Count; 
        } 
      } 
      return dm.requiresCounts ? Json(new { result = Data.Skip(dm.skip).Take(dm.take), count = count }) : Json(Data); } 
 
 
 
 
Query2 : does grid have limitation in the lenght of request uri? 
 
No, Grid does not have any limitation with URL length. 
If we misunderstood your query, could you please provide more information regarding your requirement it will be more helpful for us to provide a better solution as soon as possible. 
Regards,
R.Dhivya
 



JP Jan Poljovka May 16, 2018 01:18 PM UTC

Thank You for your answer.
It was helpful.


DR Dhivya Rajendran Syncfusion Team May 17, 2018 01:16 PM UTC

Hi Jan, 

Thanks for your update. 

We are happy to hear that the provided solution was helpful to achieve your requirement.

 
Please get back to us if you need further assistance on this.

 
Regards,
R.Dhivya 


Loader.
Up arrow icon