[CLOSED] Grid FilterHeader default type search

  1. #1

    [CLOSED] Grid FilterHeader default type search

    Hi, when insert a FilterHeader plugin in a grid:

     <ext:GridPanel ID="GridPanelClienti" runat="server" StoreID="StoreCliAge" Cls="my-grid" >
                                            <ext:Column runat="server" DataIndex="CliForCod" Text="Codice" Width="70" />
                                            <ext:Column runat="server" DataIndex="CliForRagSoc" Text="Cliente" Width="250" Wrap="True">
                                                <Renderer Fn="sospesi" />                                                                           
                                            <ext:Column runat="server" DataIndex="ComCom" Text="Comune" Width="120" />
                                            <ext:Column runat="server" DataIndex="ProSig" Text="Prov." Width="40" />
                                            <ext:DateColumn ID="DataOrdine" runat="server" Align="Center" DataIndex="data" Text="Ult.Ord." Format="dd/MM/yyyy" Width="90" />
                                            <ext:Column runat="server" DataIndex="AgeDes" Text="Agente" Width="100" />
                                        <ext:FilterHeader ID="FilterHeaderClienti" runat="server" OnCreateFilterableField="FilterHeaderClienti_CreateFilterableField" />

    the search by default is "Starts with"

    it's possible set the default to "Contains" ?

    I use this sample: https://examples2.ext.net/#/GridPane...ader/Overview/ and the column Company is by default "Starts with"

    Last edited by Daniil; Oct 28, 2013 at 2:46 PM. Reason: [CLOSED]
  2. #2
    For "Contains" logic you need to use '*' prefix, like
  3. #3
    Hi Vladimir...
    yes i read the prefix for search in the filter (+,*, ecc..)

    but il possibile set the default to 'Contains' ?
    without the user having to use the prefix ?

    it's possible use the Listener BeforeFilter to concatenate the '*' before the value and execute the filter ?

    <ext:FilterHeader ID="FilterHeaderClienti" runat="server" OnCreateFilterableField="FilterHeaderClienti_CreateFilterableField" >
                                               <BeforeFilter Fn="...." />
    I can not understand how I can concatenate '*' before the value and run the filter..

  4. #4
    Please use the following override
    Ext.net.FilterHeader.behaviour.string[0].match = function (recordValue, matchValue) {
                return (Ext.net.FilterHeader.behaviour.getStrValue(recordValue) || "").indexOf(matchValue) > -1; 
            Ext.net.FilterHeader.behaviour.string[0].serialize = function (value) {
                return {
                    type : "string",
                    op: "*",
                    value : value
  5. #5
    Hi. Vladimir

    Yeah it's work great..

    but i have a question: this override all columns to default 'Contains', it's possible set only a specific column to 'Contains' ?

    I test this code:

    function getCompanyValue(plugin) {
                if ((plugin.fields[1].value).substring(0, 1) != '*' && (plugin.fields[1].value).length > 1) {
                    plugin.fields[1].setValue("*" + plugin.fields[1].value);
    It's work, but the question is: it's possible use the column name e not a number for the fields.. (plugin.fields[columnName]) ?

    Many Thanks

  6. #6
    Please see the following sample
    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
            if (!X.IsAjaxRequest)
                this.Store1.DataSource = FiltersTestData.Data;
        protected Field OnCreateFilterableField(object sender, ColumnBase column, Field defaultField)
            if(column.DataIndex == "Company")
                defaultField.CustomConfig.Add(new ConfigItem("getValue", "getCompanyValue", ParameterMode.Raw));
            return defaultField;
    <!DOCTYPE html>
    <head runat="server">
            function getCompanyValue() {
                var value = this.getRawValue();
                if (value && value[0] !== "*" && !Ext.net.FilterHeader.behaviour.getBehaviour("string", value)) {
                    return "*" + value;
                return value;
        <form runat="server">
            <ext:ResourceManager runat="server" ScriptMode="Debug" />
            <ext:GridPanel runat="server">
                    <ext:Store ID="Store1" runat="server">
                            <ext:Model runat="server" IDProperty="Id">
                                    <ext:ModelField Name="Id" Type="Int" />
                                    <ext:ModelField Name="Company" Type="String" />
                <ColumnModel runat="server">
                        <ext:Column runat="server" Text="ID" DataIndex="Id" />
                        <ext:Column runat="server" Text="Company" DataIndex="Company" Flex="1" />
                    <ext:FilterHeader runat="server" OnCreateFilterableField="OnCreateFilterableField" />
  7. #7
    Hi Vladimir...

    Yeahhh it's super !!!! work great..

    Many many thanks


Similar Threads

  1. Replies: 6
    Last Post: Apr 27, 2016, 12:56 AM
  2. [OPEN] [#308] FilterHeader and infinite scrolling
    By HansWapenaar in forum 2.x Legacy Premium Help
    Replies: 16
    Last Post: Aug 05, 2013, 9:56 AM
  3. Default value for date type variable
    By emon in forum 1.x Help
    Replies: 10
    Last Post: Mar 10, 2011, 9:35 AM
  4. setting the default value of a date type column of store from backend ?
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Oct 16, 2009, 5:35 PM
  5. Store Sort Type not working
    By bobs in forum 1.x Help
    Replies: 2
    Last Post: Feb 10, 2009, 9:01 AM

Posting Permissions