This is a migrated thread and some comments may be shown as answers.

Dynamic cells

3 Answers 74 Views
Grid
This is a migrated thread and some comments may be shown as answers.
nagir
Top achievements
Rank 1
nagir asked on 11 May 2009, 03:40 AM
Hi,

I have a requirement to show dynamic grid. Under dynamic it's meant that following model should be displayed in the grid:
Row-1---*-Cell

Eg: there are objects Row and Cell with following information:
  1. Row can have zero or many cells of different types.
  2. Row can have zero or one cell of the same type.
  3. Cell can be in one and only one row.
  4. Number of cells in different rows might be different.

I need show this table structure on the grid with following in mind:
  1. Each row on the grid represents a Row object
  2. Each Cell on the grid represents a cell of the particular row.
  3. Each column of the grid shows cells of the same type.

Can you suggest me the best way of implementing it with RadGrid?

Dynamically creating GridColumns I have no way to tell what should be rendered in a grid cell.
I probably need to implement custom GridColumn but not sure what I have to override and where a value comes from.

Thanks,
Dmitriy.

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 14 May 2009, 06:02 AM
Hi nagir,

One possible option in this case would be to use template columns, and dynamically toggle on/off their visibility, thus meeting the requirement to have different number of cells on each row. This also gives you a great degree of flexibility with respect to the controls nested inside.

Greetings,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
nagir
Top achievements
Rank 1
answered on 14 May 2009, 06:28 AM
Yavor,

The Row--Cell model is NOT static as Cell type is not (there might be a lot of them and we cannot know it at design time).
So showing hiding of existing columns (it doesn't matter if it's a template column or a BoundColumn ) just cannot be used.

Anything else?

Only one solution I see is to convert all the model into flat Data Table and bind it to the grid autogenerating columns.
0
Yavor
Telerik team
answered on 18 May 2009, 07:44 AM
Hello nagir,

The rows in the grid must have consistent and identical structure. You can, at a later moment, hide some of the elements, and alter the span of the neighboring elements, however the structure must remain constant and identical, rather than having each row be of a different type.

Sincerely yours,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
nagir
Top achievements
Rank 1
Answers by
Yavor
Telerik team
nagir
Top achievements
Rank 1
Share this question
or