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

Interesting Observation about <ItemTemplate>

5 Answers 37 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
SSirica
Top achievements
Rank 2
Iron
Iron
Veteran
SSirica asked on 21 Jul 2010, 08:07 PM
I was setting up a multi column combobox and noticed something interesting.  1st pass I didn't set the column width, and the list came up all wavy.  That got me thinking, so I looked at the pages source code and that when I noticed that each row is rendered as it's own table.  I would have thought the list would be rendered as one table with each item having it own row, but that was not the case. 

I realize this is not so much a problem as it is me being nit picky.  I just makes the developer have to set the <tr> width.  Does a page with multiple tables take up more resources than a page with one table and multiple rows? 

5 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 22 Jul 2010, 03:32 PM
Hi SSirica,

Yes, the more tables you have, more time the browser will need to render them.

You can avoid rendering of a table per row if you put the <table> tag inside the HeaderTemplate and the </table> - inside the FooterTemplate, leaving only a <tr> element in the ItemTemplate.

I hope this helps.

Best wishes,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
SSirica
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 22 Jul 2010, 05:01 PM
When I read your suggestion it made sense.  Then I tried it, and not so much.  The header became huge, and none of the previously selectable items were selectable any more.  If you have a link to a combobox or a code snippet setup and working like you described I'd love to check it out.  Maybe I did something wrong.
0
Accepted
Simon
Telerik team
answered on 23 Jul 2010, 04:45 PM
Hi SSirica,

You are right indeed. I was a bit fast with my answer and did not take into account the following fact.

RadComboBox renders a <li> element for each Item even if it has a Template (and the approach I suggested to you will not work). In this sense having a <table> for each element will be inevitable unless you use some other element, <div> for example. In any case, many <table>s are worse than many other elements performance-wise.

Please excuse me for misleading you and let me know if you have additional questions.

Best wishes,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
SSirica
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 23 Jul 2010, 04:50 PM
No additional questions, but this might be something worth consideration for future versions. 

Thanks again.
Steve
0
Simon
Telerik team
answered on 26 Jul 2010, 05:01 PM
Hi SSirica,

Changing the way Items render at the base level would be a risky task as probably every usage of RadComboBox depends on it and it can break. Still we will have this in mind and will consider improving the Templating mechanism in the future to avoid rendering many redundant elements (as is the case with the <table>s).

Thank you for your involvement.

Best wishes,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ComboBox
Asked by
SSirica
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Simon
Telerik team
SSirica
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or