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

ejGrid possibly failing to handle search toolbar box properly with server side odata paging

Hi there,

I have implemented server-side paging as per the attached project, which I found in another ejgrid thread. I got the paging working fine, but when I switched on the search toolbar item, the search toolbar passed through the filter and caused an exception when attempting to apply the filter.

The exception is: "An exception of type 'Microsoft.Data.OData.ODataException' occurred in Microsoft.Data.OData.dll but was not handled in user code. Additional information: No function signature for the function with name 'tolower' matches the specified arguments. The function signatures considered are: tolower(Edm.String Nullable=true)."

In the example, the EmployeeID field is an integer, and the Name field is a string.

When the odata filter is generated, it shows the following string: "(substringof('1',tolower(EmployeeID))) or (substringof('1',tolower(Name)))"

I believe the EmployeeID causes the exception because it is an Integer field, and there is no tolower or substring in an integer field.

I have tried specifying the type of the column and I have tried to set no filter on the column, but it ignores those attributes and passes the EmployeeId field anyway.

I have added a second grid to the sample application, where it uses all the same data, paging, attributes etc, but I have removed the EmployeeId field. This correctly applies the filter, because the only field is the name field, and it successfully applies the filter to the linq.

I have attached a VS2015 project to this thread.

Is there something that I am doing wrong?

Kind regards,

Attachment: WebApplication7_afa17ae1.7z

3 Replies

RU Ragavee U S Syncfusion Team February 9, 2017 06:02 AM UTC

Hi Tony, 

We have analyzed the reported issue and suspect that the OData could not support searching for integer columns. Hence that issue has been occurred. If the grid contains only string column, then the search operation will work properly. However, we need to prevent the exception while searching the value in integer column and thus considered this to be an uncertain feature request. This feature will be implemented in any of our future releases.  

Ragavee U S. 

TW Tony Wright February 12, 2017 10:17 PM UTC

Hi there,

I have analysed the paging solution and determined that odata will never be suitable for this task. Firstly, it can't handle performing string searches on non-string primitive types, and secondly, it doesn't return a rowcount over the filter. (This second issue means that the rowcount will need to be a separate query that excludes the $top and $skip arguments. odata from the grid doesn't do that.)

I believe you should abandon odata and provide us with a simple json object that provides us with the filter, pagesize and skip values, and let us decide on the page of data that we return. That way we can perform the rowcount query and return a page of results as well, and I will be able to perform it in a stored procedure.

Kind regards,

RU Ragavee U S Syncfusion Team February 13, 2017 01:00 PM UTC

Hi Tony, 

Since OData doesn’t support search operation on integer columns, we suggest you to use the WebMethodAdaptor. We can perform server side paging using WebMethodAdaptor (only for ASP.NET) which is extended from the UrlAdaptor of Grid.  

While using UrlAdaptor in ASP.NET , we will get all server side properties as individual parameter in server side and need to handle those properties in server side. So, we suggest you to use WebMethodAdaptor in ASP.NET. The purpose of the WebMethodAdaptor is to bind the datamanager queries passed from client side to the DataManager class. Please refer to the following Help document, code example and sample.  

The response from server should be wrapped in an object with properties named result to hold the data and count to hold the total records count. 

Noteskip/take are the queries responsible for handling the paging action  

AllowPaging API of the Grid will handle the pagination. After enabling the AllowPaging, the Grid will be show the pager. It has been used to switching between the pages. In the server-end skip/take values will be varied according to the pagination occurred in the Grid. Refer to the following Help Document.  
While using WebMethodAdaptor, you can handle grid operation (filtering/searching/sorting) in server side. When performing filtering, sorting, editing operations on the grid queries are passed to the server side and are serialized by the DataManager class as in the below screenshot. 

The DataManager class helps in binding the Grid queries passed to the server-side. Based on those queries you can perform server-side operation on the Grid data. The query parameters that help you perform the server-side operations are as follows.  
It is used as OData Expand query.   
When this property is set to True, the total count of records are included in the result.   
Details regarding current page are skipped.   
Used to take required records from data manager.   
Records return the sorted collection.   
It is a data source table name.   
Records return the filter collection.   
DataManager Operations:   
To handle the server-side operations, we have Server-side APIs which has been found in the DataOperations class of Syncfusion Libraries. Refer to the following KB.  
The server-side operations such as sorting, filtering, paging are performed by the PerformSortingPerfomWherFilterPerformSkip and PerformTake methods.   
In Grid, we have many adaptors to perform server side operations. Please refer to the below link.   

Note: When you group a column, the query for sorting operation is passed to the server side and by default it processes and returns the processed data. The grouping operation is executed only at the client side.   

Ragavee U S. 

Live Chat Icon For mobile
Up arrow icon