Grid: Complex cell content

  • Hi all,

    I've been experimenting with a Grid that has complex objects in the model, e.g. here a record:

    {name: "Orange", type: {class: "fruit", color: "orange", description: "bla bla bla"}}

    I want this hypothetical 2-column grid to display an editable field with the name, and an editable field with the type (with "description" as tooltip and an icon for the color).

    I am puzzled because it seems that everywhere the grid and its model assume that the record's content are strings only (i.e. complex objects are simply "stringified").

    What is the best way to approach this problem?

    Thank you

    Massimo


  • Hi Tim,

    thank you, it was insightful but unfortunately not the same thing. What I decided to do, is to "flatten the object" and use extra columns (i.e. grid hidden columns) for the complex objects. According to the example above, I will have


    {type_class: "fruit", type_color: "orange", type_description: "bla bla bla"}


    I just hope the grid's performance won't degradate because of this; I can have potentially up to 120 columns (30 visible, 90 hidden). What do you think?

    Thank you

    Massimo


  • There doesn't need to be a grid column for every field defined in the store. You can use dataIndex to map to the ones you need and keep the others in there just for data purposes.


  • This thread may give you some help. http://extjs.com/forum/showthread.php?t=4537


  • Hi all,

    thank you, I will implement Jack's suggestion.

    Cheers,

    Massimo


  • There are several threads regarding grid performance, but I would say that with that many columns, depending on the number of rows, you might have issues. What would be the point of maintaining 90 hidden columns. I would think you be better served by not maintaining those in the grid. If the grid needs that data to affect the display of other visible columns, you're probably better off building an implementation that can look up hidden data in another object, rather than in the grid.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Grid: Complex cell content , Please add it free.