[CLOSED] [1.0] Local gridfilter does not work when using page proxy

  1. #1

    [CLOSED] [1.0] Local gridfilter does not work when using page proxy

    Hi,

    I'm finding a scenario where I need to use a GridFilter (just to filter the current page of data) even though the data is coming from the server, but the grid filters are not working. It seems to be related to the use of a PageProxy even though I just need local filtering of the current page.

    We use some existing System.Web.UI.DataSourceControl and DataSourceView classes to act as the data source for the Store. These DataSourceControls of ours have custom ways to get the data and they also handle paging and searching hence the use of the PageProxy.

    While I can generate the local grid filters okay (either code behind or markup) no matter what filter values you type, it looks as though nothing happens (but looking at Firebug's net tab, it is doing a post and trying to do the filter remotely even though local = true).

    If I remove the PageProxy

            <Proxy>
                <ext:PageProxy />
            </Proxy>
    And, if I remove the following code behind, then the local grid filtering works:

            private void DataStore_DataBound(object sender, EventArgs e)
            {
                ((PageProxy)DataStore.Proxy[0]).Total = MockDataSource.GetTotalDocumentsForLastQuery(DataStore.DataMember);
            }
    But of course, if I remove the above, then paging doesn't work!

    The real code is quite complex so I've spent a bit of time trying to simplify the basic operations as much as possible with some mock data, mock data source controls and views.

    I've attached a zip file of a simple Web Application project which contains only the following: Default.aspx, the mock data source, data source view, and mock data set (as XML). (plus web.config etc!)

    Please note:

    • Because of the upload size limits, you will have to add Ext.Net.dll etc manually into the bin folder
    • Then you should be able to just build it and run it.
    • By default the project will run in that Cassini Asp.Net development server which is slow to download all the resources, so you might want to map this project to a virtual directory!

    What the code is doing:

    1. Basically the Ext Store is associated with a mock DataSourceControl which is tied to a DataSourceView.
    2. Our data source control returns not only the data, but also the column info, so we have to generate all the column model, the store fields and any editors in code behind. (Hence, you will see a bizarre looking method to get an empty mock data set first just so we can get the column information and generate the columns etc on Page Init).
    3. When the page is loaded, the JsonReader requests the data from the client to the server, which ultimately results in ExecuteSelect on the DataSourceView being called. I am just returning mocked up data set, with limited paging and search mocked up.

    It is in the above setup that the local gridfilter plugin is not working.

    I hope it is possible to get this combination working. I could understand that if the GridFilters was set to remote, then we'd have to modify our DataSourceControls to support that, but in our case we just want local filtering on the current page of data using the GridFilter plugin, so I would hope that the page proxy should not be an obstacle. Hopefully I've just missed a bit of configuration somewhere :)

    If you have suggestions for improvements anywhere in this, it is much appreciated (but we cannot change our use of DataSourceControl and DataSourceView at this time). For example, perhaps there is a way not to use the PageProxy, though you will also see code in the RefreshData event handler to handle page size changes (which I have removed from the attached markup for simplicity). But ideally, I'd just like the GridFilter plugin to work with local = true...
    Attached Files
    Last edited by Daniil; Sep 13, 2010 at 8:50 AM. Reason: [CLOSED]
  2. #2
    I found some further documentation/tutorial on using grid filters on Ext Js directly and realized that looking at the GridPanel instance in firebug, that I can force local mode by doing something like this to the GridPanel:

                <Listeners>
                    <Render Single="true" Handler="#{GridPanel}.filters.local = true;" />
                </Listeners>
    Here's what I see in ViewSource (and reformatted) for the plugin initialization:

    plugins: this.ctl06 = new Ext.ux.grid.GridFilters({
        filters: [{
            dataIndex: "MyId",
            type: "numeric"
        },
        {
            dataIndex: "MyName",
            type: "string"
        }]
    })
    I am setting the local = true in code behind as part of Page_Init (see attached for full code) like this:

    
    var gridFilters = new GridFilters { Local = true };
    
    // some code to dynamically add the various filters that we see rendered out correctly
    
    GridPanel.Plugins.Add(gridFilters);
    Does that mean Ext.Net is not setting local = true when there is a PageProxy (or any proxy)?
    Last edited by anup; Sep 10, 2010 at 8:09 PM. Reason: Added example of how I am setting local = true in code behind
  3. #3
    Hi,

    Fixed. Now Local="tue" works correctly with proxy and paging toolbar
  4. #4
    Hi Vladimir,

    Many thanks for quick turnaround. Seems fixed for me. You can mark this as [solved].

    Anup

Similar Threads

  1. What exactly is Page Proxy?
    By chearner in forum 1.x Help
    Replies: 5
    Last Post: Jan 09, 2012, 9:52 PM
  2. local paging using http proxy and partialview
    By craig2005 in forum 1.x Help
    Replies: 9
    Last Post: Jan 05, 2011, 7:04 PM
  3. [CLOSED] The translation does not work using .net local file resources?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Feb 11, 2010, 2:45 PM
  4. GridFilter isn't work with date
    By flaviodamaia in forum 1.x Help
    Replies: 3
    Last Post: Jun 05, 2009, 9:06 AM
  5. Can't get AutoLoad to work with local page
    By dbassett74 in forum 1.x Help
    Replies: 1
    Last Post: Apr 23, 2009, 5:16 AM

Posting Permissions