Sep 10, 2010, 7:40 PM
[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
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:
What the code is doing:
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...
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:
- Basically the Ext Store is associated with a mock DataSourceControl which is tied to a DataSourceView.
- 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).
- 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...
Last edited by Daniil; Sep 13, 2010 at 8:50 AM.
Reason: [CLOSED]