<?xml version ="1.0" encoding="utf-8"?> <rows> <page> </page> <total> </total> <records> </records> <row id = “unique_rowid”> <cell> cellcontent </cell> <cell> <![CDATA[<font color=”red”>cell</font> content]]> </cell> … </row> <row id = “unique_rowid”> <cell> cellcontent </cell> <cell> <![CDATA[<font color=”red”>cell</font> content]]> </cell> … </row> … </rows>
The tags used in this example are explained in the following table.
| Tag | Description |
|---|---|
| rows | the root tag for the grid |
| page | the number of the requested page |
| total | the total pages of the query |
| records | the total records from the query |
| row | a particular row in the grid |
| cell | the actual data. Note that CDATA can be used. This way we can add images, links and check boxes. |
The number of cell tags in each row must equal the number of cells defined in the colModel. In our example, we defined six columns, so the number of cell tags in each row tag should be six.
Note the id attribute in the <row> tags. While this attribute can be omitted, it is a good practice to have a unique id for every row. If this attribute is omitted, jqGrid has two ways of dealing with need for unique ids:
If you are using a content-free primary key to identify your data rows, then do not include this value in the grid as a visible cell; instead, include it in the query and pass it as the row id attribute. It will always be available for jqGrid and even jQuery operations but not be visible on the page.
Now it is time to construct our file.