View Full Version : How to set id of table element of grid

4 Oct 2012, 9:14 AM
I need to set the 'id' property of the <table> html element of a grid panel, for use with a testing tool.

When I set 'id' in the grid config, a lot of the div components get id values based on this, but the table element itself does not.

Is this a bug? And if it is or not, what's the cleanest way to set the id of the table? I'd prefer a solution I can code into my view config, if possible.

xtype : 'grid',
id : 'gridtacular',
columns : [
header : 'First'
header : 'Second'

The HTML generated (all attributes removed except id):

<div id="gridtacular">
<div id="headercontainer-1010">
<div id="headercontainer-1010-innerCt">
<div id="headercontainer-1010-targetEl">
<div id="gridcolumn-1011">
<div id="gridcolumn-1011-titleEl">
<span id="gridcolumn-1011-textEl">First</span>
<div id="gridcolumn-1011-triggerEl"></div>
<div id="gridcolumn-1011-clearEl"></div>
<div id="gridcolumn-1012">
<div id="gridcolumn-1012-titleEl">
<span id="gridcolumn-1012-textEl">Second</span>
<div id="gridcolumn-1012-triggerEl"></div>
<div id="gridcolumn-1012-clearEl"></div>
<div id="gridtacular-body">
<div id="gridview-1013">

5 Oct 2012, 3:07 AM
It's definitely not a bug, the framework only adds ids where required.

You can see the markup generation for that table here:


There isn't any parameter for adding an id. You'd have to add the id after it has been rendered.