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

Undefined generated in search query using Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

142580 Feb 11,2019 07:58 AM UTC Feb 12,2019 09:15 AM UTC JavaScript - EJ 2 1
loading
Tags: Grid
Samuel
Asked On February 11, 2019 07:58 AM UTC

using the grid , and webapi and webapi adapter, I tried to search and the following query was generated
which failed on getting into the webapi controller 
  1. Request URL:
    https://localhost:44305/api/Orders/?$inlinecount=allpages&$filter=(undefined(null,undefined))%20or%20(substringof(%27jj%27,tolower(cast(Id,%20%27Edm.String%27))))%20or%20(substringof(%27jj%27,tolower(cast(IdForeign,%20%27Edm.String%27))))%20or%20(substringof(%27jj%27,tolower(cast(Name,%20%27Edm.String%27))))%20or%20(substringof(%27jj%27,tolower(cast(Done,%20%27Edm.String%27))))%20or%20(undefined(null,undefined))&$orderby=Done&$skip=0&$top=12

  2. Any way to prevent query from including undefined , like just leaving it out , or what can i do different to fix this. Thank you

Thavasianand Sankaranarayanan [Syncfusion]
Replied On February 12, 2019 09:15 AM UTC

Hi Samuel, 

Greetings from Syncfusion. 

We have analyzed your query. We could see that the “undefined” values shown in “RawValue” is for the “checkbox” column, since the field property will not be provided for the “checkbox” column, its showing as undefined. We suggest you to push only the columns to the “searchSettings.field” property to avoid undefined in query(only the columns in “searchSettings.field” will be included during searching). Please refer the code below, 

 
<script> 
    var grid = new ej.grids.Grid({ 
        dataSource: new ej.data.DataManager({ 
            url: "/api/Values", 
            adaptor: new ej.data.WebApiAdaptor(), 
            crossDomain: true 
        }), 
        ... 
        actionBegin:function(args){ 
            if (args.requestType == "searching") { 
                for (var i = 0; i < this.getColumns().length; i++) { 
                    if (this.getColumns()[i].field) { 
                        this.searchSettings.fields.push(this.getColumns()[i].field)    //These columns fields will only be included in searching. So  
                    } 
                } 
            } 
        }, 
        ... 
    }); 
    grid.appendTo("#Grid"); 
</script> 


Documentations :  
 
We have prepared a sample based on this scenario to perform searching in Grid when bound data with “WebApiAdaptor”. We are attaching the sample for your convenience. Please download the sample from the link below, 

We would also like to suggest you to refer to the “controller” code section of the below KB link, in which we have included the code to perform server side “searching” when using Web API service. 
 
Please get back to us if you need further assistance. 

Regards, 
Thavasianand S. 


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.

Please sign in to access our forum

This page will automatically be redirected to the 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

;