1. #1
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Question Unanswered: [SOLVED] Is there a way to do a nested grid or grid within a cell?

    Unanswered: [SOLVED] Is there a way to do a nested grid or grid within a cell?


    In our legacy code grid, we have cells in a column that can have multiple lines of anchor tags with each link operating on the specific linked text (pop a dialog, navigate to a new page, whatever...).

    The ClickableTextCell won't work here because it applies to an entire cell. What I'd like to be able to do is render a vertical list of clickable text cells in a single grid cell or a nested grid inside a single grid cell but don't see any way to do this.

    Does anyone know how I might accomplish this or an example somewhere? Thanks.

    --adam

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    What I'd like to be able to do is render a vertical list of clickable text cells in
    Wouldnt CompositeCell work for you?

  3. #3
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    *looks sheepishly downward*

    Ja.*

    * - Aber, Ich weiss nicht das es war da.

  4. #4
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Question


    So, it's not exactly clear how I get the list of HasCell to the constructor.

    I.e., if I have:
    Code:
        ColumnConfig<MyBean, MyBean> myCol =
          new ColumnConfig<MyBean, MyBean>(new IdentityValueProvider<MyBean>(), 100, "My Col");
        productCol.setCell(new CompositeCell<MyBean>(...));
    MyBean has a getter that returns List<String> - I would need to create, say, a ClickableTextCell for each of these, add them to a list and get that list to the constructor (marked with the ellipsis above).

    It's not at all clear how to create this. I'm using GXT's PropertyAccess interface to provide the values for the columns.

  5. #5
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    HasCell is just an interface. You can simple create an "instance" from it and make it return your "inner" cell.

  6. #6
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Right, but the instances would need to each provide a corresponding value from the list of strings off of my bean. A list I don't have because we are dealing with the class type and not an instance type when we are defining the column config.

    Is there a way you can provide a generic example, please? Thanks.

  7. #7
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I do not have an example, sorry.

    Another solution would be to create a custom cell that takes a list of strings and renders them exactly has you require it.

  8. #8
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Ok. That's the road I started going down...a custom composite cell where my bean implements an interface that provides the list of strings.

    It gets a little more tricky because each cell also needs to have a click handler so the custom composite cell also needs to take in a callback handler so each usage can specify what happens when a cell is clicked.

    Thanks for the initial pointer.

  9. #9
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    So, it turns out it isn't really possible to use CompositeCell in its current form with GXT. The problem is that the constructor for CompositeCell takes in a list of HasCell objects, which essentially is a list of objects that are to be rendered in the outer grid cell (for lack of a better term).

    This list is not known at cell construction time - which is ultimately required when constructing a ColumnConfig and calling setCell(...). In fact, short of the getters, none of the model data is known at construction time - the contents of grid cells are delivered via the PropertyAccess interface methods.

    I copied the CompositeCell class and took a chainsaw to it and managed to hack something together, but because I don't have the list of cells to render, I had to engineer some interfaces to allow for them to be provided. But since they aren't available at construction time, I have to generate them for each method called as part of rendering and/or event handling which is way overkill.

    If each method uses the same list reference, then event handling will only retain knowledge of the last row in the grid. If each method regenerates the list each time, no events are fired because the initial list of cells is no longer able to be referenced.

    I could add a map in the class to store a, say rowId, to cell list mapping but then it's not really a CompositeCell anymore, it's a CompositeCellListStoreContainer. I'm shelving this work because it was only a spike and isn't critical for my current scope of work. I will probably come back to it at some point to prove the map concept works - if however stinky.

    Ultimately, I'd like to see GXT support a use for CompositeCell-like functionality or roll their own as GWT's version is not usable within GXT.

  10. #10
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Answers
    60
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    I cannot really follow you why CompositeCell does not work together with GXT? I am using it in several places without any problem.

Thread Participants: 1

Tags for this Thread