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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Change Filter to "Contains"

Thread ID:

Created:

Updated:

Platform:

Replies:

150826 Jan 21,2020 11:57 AM UTC Jan 22,2020 02:26 PM UTC ASP.NET Web Forms 1
loading
Tags: Grid
Bill Faries
Asked On January 21, 2020 11:57 AM UTC

Hi, is this the correct layout needed for changing a column filter to contains? it does the auto fill ok but doesn't seem to be taking on the contains portion



 <ej:Grid ID="Grid1" runat='server' AllowFiltering="true" AllowPaging="true" CssClass="" DataSourceCachingMode="None" DataSourceID="SqlDataSource1" EnableLoadOnDemand="False" MinWidth="0">
        <Columns>

            <ej:Column AllowEditing="False" DataType="number" Visible="false" Field="id" IsIdentity="True" IsPrimaryKey="True">
            </ej:Column>
           <ej:Column DataType="string" Field="fullnameGive" AllowFiltering="true" HeaderText="Giving">

                </ej:Column>
                <ej:Column DataType="string"  Field="fullnameReceive" AllowFiltering="true" HeaderText="Receiving">
                                 <FilterBarTemplate Create="autoComplete_create" Write="autoComplete_write" Read ="autoComplete_read" />
                </ej:Column>
            <ej:Column DataType="string" Field="type" Width="190px" AllowFiltering="true" HeaderText="Type">
            </ej:Column>
            <ej:Column DataType="string" Field="description" Width="500px" AllowFiltering="true" HeaderText="Description">
            </ej:Column>
            <ej:Column DataType="date" Field="date" Width="100px" AllowFiltering="true" HeaderText="Date">
            </ej:Column>
            <ej:Column DataType="string" Visible="false" Field="isApproved">
            </ej:Column>
        </Columns>
    </ej:Grid>





         <script type="text/javascript"> 
        function autoComplete_create(args) {
            return "<input>"
        }

        function autoComplete_write(args) {
var gridObj = $('#<%= Grid1.ClientID %>').data("ejGrid");
            var data = ej.DataManager(gridObj.model.dataSource).executeLocal(new ej.Query().select("fullnameReceive"));
            args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, focusOut: ej.proxy(args.column.filterBarTemplate.read, this, args) });
        }

        function autoComplete_read(args) {
            this.filterColumn(args.column.field, "contains", args.element.val(), "and", true)
        }

       
    </script>

Farveen Sulthana Thameeztheen Basha [Syncfusion]
Replied On January 22, 2020 02:26 PM UTC

Hi Bill, 

Thanks for contacting Syncfusion Support. 

We have checked your query and if you want to change filter operator to “contains”, you can set the filterType property of the autoComplete as “contains”. Also by using this property you can operator as greaterthan, lessthan as per your requirement. 


Refer to the code example:- 
<script type="text/javascript"> 
    function autoComplete_create(args) { 
        return "<input>" 
    } 
 
    function autoComplete_write(args) { 
        var gridObj = $('#<%= Grid1.ClientID %>').data("ejGrid"); 
        var data = ej.DataManager(gridObj.model.dataSource).executeLocal(new ej.Query().select("fullnameReceive")); 
        args.element.ejAutocomplete({ width: "100%", dataSource: data, enableDistinct: true, filterType:"contains", focusOut: ej.proxy(args.column.filterBarTemplate.read, this, args) }); 
    } 
 
    function autoComplete_read(args) { 
        this.filterColumn(args.column.field, "contains", args.element.val(), "and", true) 
    } 
 
 
</script> 

Refer to the API Link:- 

Please get back to us if you need any further assistance. 

Regards, 
Farveen sulthana T 


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

Live Chat Icon For mobile
Live Chat Icon