1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    0
    quizzl is on a distinguished road

      0  

    Default Unanswered: Grouped Grid Grouping "Fake/Non-Existing Records"

    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.
    eg.PNG

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,643
    Answers
    3453
    Vote Rating
    816
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    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 services@sencha.com

    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.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    0
    quizzl is on a distinguished road

      0  

    Default


    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.

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    21
    Vote Rating
    0
    quizzl is on a distinguished road

      0  

    Default


    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.

Thread Participants: 1