PDA

View Full Version : m:n relational data filtering through mapping store



Funnyprinter
3 Apr 2011, 10:03 PM
Hey,

I'm new to extjs and don't know there to find the documentation yet. Maybe you can help me to solve the following problem: I have 3 stores and 2 grids. The databinding to the stores to the grids works already. All data is displayed. The situation is as follows:

Stores
UsersStore (UserId, UserName)
GroupsStore (GroupId, GroupName)
UserGroupMappingStore(UserId, GroupId)
Grids
UsersGrid
GroupsGrid

If I click a user now, I want to filter for the assigned groups and verse vise. Also I need a button to remove all filters again. My attempt was the following:



MappingFrontend = Ext.extend(AboutFrontendUi, {
initComponent: function() {
UserFrontend.superclass.initComponent.call(this);

this.findById("usersGrid").on("rowclick", function(grid, rowIndex, e) {
Ext.StoreMgr.lookup("partnerusermappingStore").filter("UserId", grid.getStore().getAt(rowIndex).get("UserId"));
Ext.StoreMgr.lookup("partnersStore").filter("PartnerId", Ext.StoreMgr.lookup("partnerusermappingStore").get("PartnerId"));
});
}
});


I'm pretty sure the first filter is working, however I don't know how to bind the mapping store to the partner store. Please also let me know, where the docs for the classes are.

Thanks for your help,

Manuel