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. Image for the cookie policy date

What is the relationship between Grid and the Data Manager Query?

1) What is the purpose of the Grid query property?
2) Is it just  limit the initial data that the Grid loads?

If I use a Query with my custom adapter the data sent to the server is in the correct format.  However when using grid filtering it adds tolower to the request

{filter: "tolower(last_name) = 'yuan'"} which causes my api to return an error

Alternatively just using a query directly, not bound to a Grid
var query = ej.Query()
.from("contact")
.select("last_name","first_name")
.where("last_name", "equal" , "Yuan");
Results in a request of 
  1. {"fields":"last_name,first_name","filter":"last_name = 'Yuan'"}
Also in the above query .select is used to limit the columns returned from the server however in the Grid if you specify only certain columns all columns are still returned from the server.

Thanks


5 Replies

PK Prasanna Kumar Viswanathan Syncfusion Team November 10, 2016 01:09 PM UTC

Hi Dan, 

Thanks for contacting Syncfusion support. 

      Queries 
                                          Response 

What is the purpose of the Grid query property”? 


The purpose of the Grid query is to communicate with the grid dataSource and returns the desired output based on the query provided. Using grid query we can perform various operation like filtering, searching etc. 

We can also pass an additional parameter to an controller action, use the query API.  In this sample we pass the parameter in addParams property using query API. 

For more information refer the below document, 




Alternatively just using a query directly, not bound to a Grid” 


We checked in our sample with the mentioned query and we can able to render the specific column in the grid.  

Find the code example and sample: 

var queryOrder=ej.Query().select("OrderID", "CustomerID").where("CustomerID", "equal", "TOMSP");  
        ------------------------- 
       $(function () { 
          $("#Grid").ejGrid({ 
              dataSource: dataManger, 
              allowPaging: true, 
              allowFiltering : true, 
              columns: [ 
                  --------------------------- 
              ] 
          });      
        }); 


To find out the root cause of the issue, Share the following details 

1. Code example of a Grid. 

2. If you face any script error in the sample, Share the stackrace of an issue. 

3. Essential Studio Version details.  

4. If possible, replicate the issue in the attached sample.  


However when using grid filtering it adds tolower to the request” 


The purpose of adding is tolower on the request is to avoid the case-sensitive while searching the results. When we search with Capital letters or small letters it will return the same result in the server.  

For more information please refer the below link 



Is it just  limit the initial data that the Grid loads?” 


If you bind more number of data in grid, we suggest you to use OnDemand Paging feature of ejGrid.  The OnDemand paging feature is used to get records of the particular page from the server-side.  

To achieve OnDemand paging, we suggest you to bind the remote data and enable paging in the grid.  



Regards, 
Prasanna Kumar N.S.V 
 



DA dan November 14, 2016 06:58 PM UTC

Regarding the Grid sending the tolower:

When I debug the OdataAdapter onPredicate: function (pred, query, requiresCast) 
pred.ignoreCase is always = true.  I have tried various grid settings such as 

  filterSettings: {showPredicate:true ,filterType : "menu",enableCaseSensitivity:true},
  searchSettings: {ignoreCase:false},

But from the docs it looks like enableCaseSensitivity only works with the filterType : "excel" which I am not using.

So is there a Grid setting to set ignoreCase to false?

I am able to work around this problem in my onPredicate override.


PK Prasanna Kumar Viswanathan Syncfusion Team November 16, 2016 12:10 PM UTC

Hi Dan, 

In our current implementation of the grid filter bar’s, the matchcase is default set as false in the filterCollection. If matchcase is set as false, then the ignoreCase will be set as true in ej.Predicate. To change the default matchcase value in filter collection, use actionBegin event of ejGrid.  This event will be triggered for every grid before its starts. In this event we can get filter collection in the arguments, using that we can change the matchcase value.  
 
Find the code example and sample:  
 
 
$("#Grid").ejGrid({ 
              dataSource: dataManger, 
              allowPaging: true, 
              allowFiltering: true, 
              actionBegin : "begin", 
              columns: [ 
                      ------------------------------------ 
             ] 
          });      
        }); 
 
        function begin(args) { 
            if (args.requestType == "filtering") { 
                args.filterCollection[0].matchcase = true; 
            } 
        } 
 
 

Refer to the Help document for the actionBegin event. 


Regards, 
Prasanna Kumar N.S.V 



DA dan November 16, 2016 01:05 PM UTC

Thank you, that works.


PK Prasanna Kumar Viswanathan Syncfusion Team November 17, 2016 05:14 AM UTC

Hi Dan, 

We are happy to hear that your issue has been resolved. 

Please let us know if you need any further assistance. 

Regards, 
Prasanna Kumar N.S.V 


Loader.
Live Chat Icon For mobile
Up arrow icon