" />

Interesting Observation about <ItemTemplate>

6 posts, 1 answers
  1. SSirica
    SSirica avatar
    86 posts
    Member since:
    Jan 2007

    Posted 21 Jul 2010 Link to this post

    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? 
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 22 Jul 2010 Link to this post

    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
  3. SSirica
    SSirica avatar
    86 posts
    Member since:
    Jan 2007

    Posted 22 Jul 2010 Link to this post

    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.
  4. Answer
    Simon
    Admin
    Simon avatar
    2281 posts

    Posted 23 Jul 2010 Link to this post

    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
  5. SSirica
    SSirica avatar
    86 posts
    Member since:
    Jan 2007

    Posted 23 Jul 2010 Link to this post

    No additional questions, but this might be something worth consideration for future versions. 

    Thanks again.
    Steve
  6. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 26 Jul 2010 Link to this post

    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
Back to Top