[CLOSED] Grid Column filter

  1. #1

    [CLOSED] Grid Column filter

    Hi,

    I have a requirement to filter the multiple records listed in the grid. Current filter option allow us to filter only one value. We would like to filter multiple values .

    Say for instance if i enter AUD in the filter column it brings only AUD. As per my requiremnt if i enter AUD, INR it should return the grid rows satisfying these 2 criteria.


    Youe help is greatly appreciated.

    Thanks
    Ram
    Last edited by Daniil; Nov 29, 2010 at 5:32 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Which filter functionality do you use? GridFilters plugin or 'filter' method of the store?
  3. #3
    Hi,

    My current requirement is Grid filter plugin.

    My requiremtn is to search multiple values


    (We have actually used both the type of filters).



    Quote Originally Posted by Vladimir View Post
    Hi,

    Which filter functionality do you use? GridFilters plugin or 'filter' method of the store?
    Thanks
    Dharini
  4. #4
    Hi,

    New GridFilters functionality was added to the toolkit recently (e.g. ValidateRecord). Seems it can help to achieve your requirement.

    Here is an example.
    http://forums.ext.net/showthread.php...ll=1#post43525
  5. #5

    Version Issue

    Hi,

    As per your reply we downloaded the coolite kit version 1.0 from the link

    http://svn.ext.net/premium/branches/

    We wonder whether this is the right link as, when we tried running the sample given in the link
    http://forums.ext.net/showthread.php...ll=1#post43525
    (in the downloaded source) throws errror.


    This is the error we have received
    Type 'Ext.Net.StringFilter' does not have a public property named 'ValidateRecord'.
    Could you please help on this?

    Your quick reply is greatly appreciated

    Thanks
    Ram
    Last edited by Daniil; Nov 26, 2010 at 1:09 PM. Reason: Please use [CODE] tags, editted link
  6. #6
    Quote Originally Posted by majestic View Post
    As per your reply we downloaded the coolite kit version 1.0 from the link

    http://svn.ext.net/premium/branches/
    The SVN location was moved. Please update from the following link
    http://svn.ext.net/premium/trunk


    Quote Originally Posted by majestic View Post
    We wonder whether this is the right link as, when we tried running the sample given in the link http://forums.ext.net/showthread.php...ll=1#post43525 (in the downloaded source) throws errror.
    The link is broken. Could you edit?
  7. #7

    Gridview column filter

    Hi,

    My requirement is different as i indicated earlier..

    We would like to have the grid filter work as in the attached screen shot.

    The filter should allow multiple values separated by the separator..




    Quote Originally Posted by Daniil View Post
    The SVN location was moved. Please update from the following link
    http://svn.ext.net/premium/trunk




    The link is broken. Could you edit?
    Attached Thumbnails Click image for larger version. 

Name:	1.JPG 
Views:	264 
Size:	73.8 KB 
ID:	1950   Click image for larger version. 

Name:	2.JPG 
Views:	196 
Size:	72.4 KB 
ID:	1951  
  8. #8
    Sure, there is just an example how to use ValidateRecord.

    Within ValidateRecord you have filter's value (you have to split(",") this value) and a current record.

    Just return true if a record's data has a value from filter's value.
  9. #9

    Filter using split

    Hi,

    I used the following script to implement multiple value search in the grid filter
    <script type="text/javascript"> 
            var myValidateRecord = function (record) 
            {             
            debugger;
                var filterValue = this.getValue(); 
                if (filterValue.length == 0) { 
                    return true; 
                } 
                if (!this.filteredRecords) { 
                    this.filteredRecords = Store2.query('name', filterValue.split(","), true, false); 
                } 
                var code = record.get(this.dataIndex), 
                    index = this.filteredRecords.findIndexBy( 
                    function(record) { 
                        return record && (code == record.get('code')); 
                    } 
                ); 
                return index != -1; 
            } 
        </script>
    this.filteredRecords = Store2.query('name', filterValue.split(","), true, false);
    It does not return the results after splitting..
    Could you please tell me where i went wrong in the above code?

    Thanks
    Ram





    Quote Originally Posted by Daniil View Post
    Sure, there is just an example how to use ValidateRecord.

    Within ValidateRecord you have filter's value (you have to split(",") this value) and a current record.

    Just return true if a record's data has a value from filter's value.
    Last edited by Daniil; Nov 26, 2010 at 1:05 PM. Reason: Please use [CODE] tags
  10. #10
    Please investigate the following example.

    Example
    <%@ 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)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[]
                {
                    new object[] {"test1"},
                    new object[] {"test2"},
                    new object[] {"test3"},
                    new object[] {"test4"},
                    new object[] {"test5"},
                    new object[] {"test6"},
                    new object[] {"test7"},
                    new object[] {"test8"},
                    new object[] {"test9"}
                };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    
        <script type="text/javascript">
            var myValidateRecord = function(filter, record) {
                var filterValue = filter.getValue();
                if (filterValue.length == 0) {
                    return true;
                }
                var values = filterValue.split(",");
                for (var i = 0; i < values.length; i++) {
                    if (record.get(filter.dataIndex) === values[i].trim()) {
                        return true;    
                    }
                }
                return false;
            }
        </script>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <Plugins>
                <ext:GridFilters runat="server">
                    <Filters>
                        <ext:StringFilter DataIndex="test">
                            <ValidateRecord Handler="return myValidateRecord(this, record);" />
                        </ext:StringFilter>
                    </Filters>
                </ext:GridFilters>
            </Plugins>
        </ext:GridPanel>
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 2
    Last Post: May 01, 2012, 4:57 PM
  2. Ext:Column and Filter Icon
    By cwolcott in forum 2.x Help
    Replies: 6
    Last Post: Mar 21, 2012, 1:53 PM
  3. [CLOSED] Missing filter column using MultiHeader Filter.
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Aug 12, 2010, 1:07 PM
  4. [CLOSED] Add filter button to grid column header
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 08, 2009, 10:10 AM
  5. [CLOSED] Intercept column filter event
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 09, 2009, 2:08 PM

Tags for this Thread

Posting Permissions