How can I get theader
on a jqGrid using jQuery?
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
If a
thead
andth
exists on the DOM, it can be selected. Do you have an example of what you're trying to do?Try:
My short answer is: instead of selecting of the DOM elements which corresponds
<th>
elements which you are looking for you should useIt returns the array of this DOM elements, corresponds the
<th>
. The long description of my answer follows.I understand the reason of your question. If you have for example defined the base part of jqGrid as
then
$("#list")
gives you<table>
with only the "data" part of the grid without headers. 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:(here in the table I used
rownumbers: true
, so there areth#list_rn
, the first column has the name 'Col1', so there areth#list_Col1
and so on)You can see, that the header table
table.ui-jqgrid-htable
can has two child<tr>
subelements: onetr.ui-jqgrid-labels
for the column headers and onetr.ui-search-toolbar
for thefilterToolbar
.My suggestion for you don't use this relatively complex hierarchy, but use another short hidden way existing in jqGrid. The code
get you DOM element of the table element. This element has some important extension which are made by jqGrid. This are
gridDom.p
which contain all parameters of jqGrid. Another important extension isgridDom.grid
with important propertiesbDiv
,cDiv
,hDiv
,fbDiv
,fhDiv
,uDiv
and alsocols
,footers
,topDiv
andheaders
. I suggest you to usegridDom.grid.headers
array as the best way to receive a list of<th>
elements from the grid column headers (from the correct<tr>
row).