I have two tables in the database: Devices and Groups. Groups can contain devices and/or sub-groups. Both tables basically have id, name and groupId (parentId) columns.
On the front-end I have two corresponding stores, but I also want to display the hierarchy in tree panel. To achieve this, in the tree panel I have memory store and in view controller I subscribe to update events on Devices and Groups stores. On every update I combine data from two stores into an array of nodes, and then ask store to reload data from proxy:
Everything works fine until I decided to implement filtering in my tree panel. If any field is updated on filtered data, I get error like this:Code:store.getProxy().setData(nodes); store.load();
where parentId is basically groupId and "g4" is the id of a group. I get this error even I don't filter out any groups.Ext.data.TreeStore.treeify(): Ext.data.TreeStore, Invalid parentId "g4"
Does anyone have an idea why it can be happening and how to fix it?
Also, maybe there is a better way to combine two flat stores into a tree store?