PDA

View Full Version : GridPanel paging is removing filter



mhd
Jul 31, 2014, 12:43 AM
I have problems trying to use a gridpanel with a pager and local gridfilters. If I apply a filterby to my gridPanel from javaScript function, my local filter work perfectly and i get what i need. But when i click next page arrow in paging toolBar, my local filter is no more active and the gridPanel will display the content of the entire store. So moving to the next page from toolBar paging will ignore/delete filters created locally in javaScript

Vladimir
Jul 31, 2014, 8:22 AM
Hi

I cannot reproduce it, i tried the following sample
http://examples2.ext.net/Examples/GridPanel/Paging_and_Sorting/Local_Data_Paging/

and apply the following filter in the console


App.Store1.filterBy(function(r){return r.data.price > 50;})


after that i navigate between grid pages and all works fine (filter is not ignored)

mhd
Jul 31, 2014, 2:19 PM
Hi,

Here is how i define my gridPanel



@(Html.X().FormPanel()

.Layout(LayoutType.Fit).Items(
Html.X().GridPanel().ID("ObservedGrid")
.EnableColumnResize(true)
.AllowDeselect(true)
.Split(true)
.AutoScroll(true)
.MultiSelect(true)
.EmptyText("No observed data at this time")
.MessageBusDirectEvents(
new MessageBusDirectEvent()
{
Name = "Stations.Select",
Action = "SetSelectedStations"
,
ExtraParams = { new Ext.Net.Parameter() { Name = "selectedStationsIcao", Value = "data", Mode = ParameterMode.Raw } }

}
)
.Store(Html.X().Store().ID("ObservedStore")
.PageSize(15)
.DataSource(Model)
.Model(Html.X().Model()
.Fields(
....
Html.X().ModelField().Name("id"),
Html.X().ModelField().Name("name"),
.....
))
.Sorters(Html.X().DataSorter().Property("name").Direction(Ext.Net.SortDirection.ASC)
)
.MessageBusListeners(new MessageBusListener()
{
Name = "Stations.RegisterMap",
Fn = "RegisterMap"
}
)
)
.ColumnModel(
.....
Html.X().Column().Text("Station").DataIndex("id").Flex(10).Hideable(false),
......
)
.Features(
Html.X().GridFilters()
.Local(true)
.Filters(
Html.X().StringFilter().DataIndex("id")
)
)
.BottomBar(
Html.X().PagingToolbar().HideRefresh(true).Items(
....
)
)
.SelectionModel(
Html.X().RowSelectionModel().Mode(SelectionMode.Mu lti))
.Plugins(
Html.X().RowExpander()
.SingleExpand(false)
.TemplateHtml(...)

))
)



and i apply my filter in javascript like that:



var observedStore = Ext.getCmp('ObservedGrid').getStore();

observedStore.filterBy(function (record) {
return Ext.Array.contains(stationsNameArray, record.get('name'));
});


stationsNameArray is an array of names that i want to display throw my gripdPanel.
i looked to your example and i did't find any difference except the proxy since i'm not using it.

Vladimir
Jul 31, 2014, 2:22 PM
i looked to your example and i did't find any difference except the proxy since i'm not using it.

that online example doesn't use any proxy

mhd
Jul 31, 2014, 2:29 PM
any clue how to deal with this problem

Vladimir
Jul 31, 2014, 2:34 PM
You need to post simple runable sample reproduces the issue

mhd
Jul 31, 2014, 3:11 PM
thanks for your help.
I just fount the solution: if i remove the GridFilters defined in the Features section i have no more the problem.
is it a bug or we can't define custom javascript filter beside features gridFilter?

geoffrey.mcgill
Jul 31, 2014, 3:30 PM
Sure, it might be a defect. We will investigate if we are ever able to create a sample that reproduces the problem.

mhd
Jul 31, 2014, 3:47 PM
To reproduce the issue try to use this example http://examples2.ext.net/Examples/GridPanel/Paging_and_Sorting/Local_Data_Paging/

-Add some GridFilters in the Features section of the grid

-Apply a new filter in the console for example

App.Store1.filterBy(function(r){return r.data.price > 30;})

- Try to navigate between grid pages and will get the issue (the second filter will be ignored)