Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>My short answer is: instead of selecting of the DOM elements which corresponds <code>&lt;th&gt;</code> elements which you are looking for you should use</p> <pre><code>$("#list")[0].grid.headers </code></pre> <p>It returns the array of this DOM elements, corresponds the <code>&lt;th&gt;</code>. The long description of my answer follows.</p> <p>I understand the reason of your question. If you have for example defined the base part of jqGrid as</p> <pre class="lang-html prettyprint-override"><code>&lt;table id="list"&gt;&lt;/table&gt; &lt;div id="pager"&gt;&lt;/div&gt; </code></pre> <p>then <code>$("#list")</code> gives you <code>&lt;table&gt;</code> with only the <strong>"data"</strong> part of the grid <strong>without headers</strong>. The main "data" part of the table will be placed inside some divs. Other elements of jqGrid will be placed in the divs as a tables. The structure of jqGrid (not full) will looks like following:</p> <pre class="lang-none prettyprint-override"><code>div.ui-jqgrid#gbox_list div.ui-jqgrid-view#gview_list div.ui-jqgrid-titlebar - caption div.ui-userdata#t_list - optional top toolbar div.ui-jqgrid-toppager#list_toppager - optional top pager div.ui-jqgrid-hdiv - all grid headers div.ui-jqgrid-hbox - (div.ui-jqgrid-hbox-rtl) if direction:"rtl" table.ui-jqgrid-htable thead tr.ui-jqgrid-labels - row with column headers (labels) th#list_rn - optional column header with row numbers th#list_Col1 - column header for the column name:"Col1" ... th#list_level - optional column header for some other special columns in case of usage TreeGrid the hidden columns of TreeGrid are: level, parent, isLeaf, expanded, loaded, icon tr.ui-search-toolbar - row for toolbar searching th th ... div.frozen-div.ui-jqgrid-hdiv - optional frozen headers table.ui-jqgrid-htable - table with frozen columns headers only ... div.ui-jqgrid-bdiv - div with the main grid data div table#list - table with the main grid data div.frozen-bdiv.ui-jqgrid-bdiv - optional div with the main grid data div table#list_frozen - table with the main grid data div.ui-userdata#tb_list - optional bottom toolbar div.ui-jqgrid-resize-mark#rs_mlist div.ui-jqgrid-pager#pager - the div with the pager </code></pre> <p>(here in the table I used <code>rownumbers: true</code>, so there are <code>th#list_rn</code>, the first column has the name 'Col1', so there are <code>th#list_Col1</code> and so on)</p> <p>You can see, that the header table <code>table.ui-jqgrid-htable</code> can has two child <code>&lt;tr&gt;</code> subelements: one <code>tr.ui-jqgrid-labels</code> for the column headers and one <code>tr.ui-search-toolbar</code> for the <code>filterToolbar</code>.</p> <p>My suggestion for you don't use this relatively complex hierarchy, but use another short hidden way existing in jqGrid. The code</p> <pre class="lang-js prettyprint-override"><code>var gridDom = $("#list")[0]; </code></pre> <p>get you DOM element of the table element. This element has some important extension which are made by jqGrid. This are <code>gridDom.p</code> which contain all parameters of jqGrid. Another important extension is <code>gridDom.grid</code> with important properties <code>bDiv</code>, <code>cDiv</code>, <code>hDiv</code>, <code>fbDiv</code>, <code>fhDiv</code>, <code>uDiv</code> and also <code>cols</code>, <code>footers</code>, <code>topDiv</code> and <code>headers</code>. I suggest you to use <code>gridDom.grid.headers</code> array as the best way to receive a list of <code>&lt;th&gt;</code> elements from the grid column headers (from the correct <code>&lt;tr&gt;</code> row).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload