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

How can the 300px default grid size be substituted?

5 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alexandru
Top achievements
Rank 1
Alexandru asked on 25 Nov 2008, 03:42 PM
Hi, I have a grid included in page and I saw that the default height for it is 300px. I want the grid to readjust it's size depending on the number of records it contains. This default height is put into the inner classes of the grid? It cannot be replaced. It would be nice to have a readjustment of the height depending on the number of rows. What can I do? Any ideas?
Thank you.

5 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 25 Nov 2008, 03:49 PM
Hi Alexandru,

I guess you are using scrolling with static headers. In this case, a default height must be used, so that the data area of RadGrid is scrollable.

If you want RadGrid to adjust its dimensions, according to the available space, you need to set Height="100%".

If you want RadGrid to adjust its dimensions, according to the number of records, you need to disable scrolling and static headers and do not set any Height.

Let us know if you need more information or if your scenario is somewhat special.


Greetings,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alexandru
Top achievements
Rank 1
answered on 25 Nov 2008, 04:13 PM
Disabling scrolling and static headers and not setting any Height indeed showed the desired behavior, BUT the headers are now all modified, not being static anymore. They have totally different widths even if I kept the Width set for each one of them.
0
Dimo
Telerik team
answered on 25 Nov 2008, 04:48 PM
Hi Alexandru,

The easiest way to have all columns the same size is to set TableLayout="Fixed" for the MasterTableView. You will not need any column widths set in this case. However, please note that if no column widths are set, the sum of widths of all column will be equal to the width of the RadGrid control, which means that if you have a large number of columns, the content will get stuffed in too little space. To avoid this, you can set a larger with in pixels for the MasterTableView.

Setting column widths explicitly should work. If you want more information about why there is a problem with this at the moment, please send us your RadGrid declaration.

Sincerely yours,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Alexandru
Top achievements
Rank 1
answered on 25 Nov 2008, 05:09 PM
Hello again,
Now the grid behaves just as I had in mind. In addition to what I have done earlier I have also removed the TableLayout=Fixed property from the MasterTableView. So, Thanks a lot.

I'd like to ask one more question: Now I have a width set for each header and column. If the information in one cell exceeds this width and makes the line stretch in height, what shoul I consider for that situation? Is there a way to set an overflow:ellipsis or something like that?

Thank you,
Alex.
0
Dimo
Telerik team
answered on 25 Nov 2008, 05:24 PM
Hello Alexandru,

If you set TableLayout="Fixed" for the MasterTableView and enable RadGrid scrolling with static headers, the text-overflow:ellipsis CSS style will be applied to RadGrid cells automatically. Of course, you can achieve the same thing by adding the required styles manually, so that you don't have to enable Scrolling. However, you will need a fixed table layout in all cases. In order to make text-overflow:ellipsis work (if you add it manually), you also need to set overflow:hidden style for the master table and the cells.

Let us know if you need more information.

Kind regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Alexandru
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Alexandru
Top achievements
Rank 1
Share this question
or