25 Nov 2011 7:25 AM #1
Unanswered: Grouped Grid Grouping "Fake/Non-Existing Records"
Ok I am facing another dilemma with my web application that might not even be solvable like that.
Basically what I am using a grid that can have entries for categories. The grid is grouped by categories always and can not be ungrouped.
In the group header I have an add button that leads to a creation dialog of an item for that category.
All of that works fine the problem is that I need to display all of these categories at all times even if there is no actual record in the grid yet because the user has to be able to see the header, see there is nothing grouped there so no record exists and use the add button to create one of those records.
What I do is I create one fake entry with just the category to get the group header for that category. My problem is now that I somehow need to hide the row and remove the expand/collapse functionality from all those group headers that do not include a valid record.
Right now I can't figure out any way to do this. I am 90% to where I want to get with the widget but it seems like I need to solve this with maybe a VBox Layout and for each category its own collapsible Grid?
This is my current look. In this example there are just fake entries but there could be valid entries too. My goal is that the groups with fake entries are collapsed automatically and can not be expanded while the groups that contain valid entries should be as it is now.
25 Nov 2011 8:05 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
So you have a group with no records so you have a fake one to show the group... when you click add and the form is saved and that record is then created... what you should do is see if there is that fake record and remove it from the Store. To stop group collapsing/expanding, you need to override onGroupClick of the Grouping feature to add additional logic.Mitchell Simoens @LikelyMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services firstname.lastname@example.org
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
25 Nov 2011 10:37 AM #3
well yes the thing is how would I iterate over the grouped headers to collapse them or expand them, my problem is I dont know how to access the groups to set properties appropriately and style.
Overriding the expansion even for certain groups is just one of my problems. I don't want to disable the event for the entire grid, only for those grouped records that have only a stub record. I also want to hide the collapse icon if the even is disabled.
28 Nov 2011 5:28 AM #4
I re-worked my entire code now so that instead of using one grid and grouping records appropriately and then possibly having to iterate over the groups and making changes to events for each group and state I put a vbox layout panel in the center instead of the one grid.
The vbox panel now holds a dynamic number of grids for each category so I can comfortably iterate over the grids and records to set the properties as I need them on certain events.