jqGrid筆記-1-概況

jqGrid
http://www.trirand.com/jqgridwiki/doku.php
How to Install
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_to_install
Downloading jqGrid
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:download
files needed for using jqGrid are in main /css/ and /js/ directories
使用jqGrid需要的文件主要存在/css/ 和 /js/文件夾中。
Files in /src/ directory are actually the pure source code and can be used from developers to easily find bugs and make improvements.
/src/ 文件夾中的文件只是純代碼,開發人員可以利用它來對代碼進行改進和除錯。
In order to use the grid plugin you will need to download the desired theme.
爲了使用jqGrid你還需要下載jQuery的UI主題(jQuery UI theming).
If you plan to use only the grid component you do not need to have all the CSS files that come from the package. In this case you will need to use only basic theming files ui.theme.css and ui.core.css. These files are located in development-bundle/themes directory in the downloaded UI theme file.
如果你只想使用grid組件,就不需要使用所有的CSS文件。只要使用基本的主題文件就好,它們是ui.theme.css 和 ui.core.css。這些文件放在development-bundle/themes文件夾裏。
How it Works
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:how_it_works
A jqGrid is comprised of the following four parts:
一個jqGrid由4部分組成:
    Caption layer 標題欄
    Header layer 表頭
    Body layer  表體
    Navigation layer導航欄
My First Grid
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:first_grid
傳遞的xml數據結構:
<?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>
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.
每個row中的cell的數量必須與表格的列數相同也就是colModel中定義的列的個數。
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 the property key in the colModel is set to true for a particular column, then jqGrid will assign the value of this column to be the id of the row; otherwise, jqGrid sets the row id based on the order of the row.
注意row標籤中的id屬性。這個屬性可以省略。但最好有一個唯一的量來標識一行。如果省略了id屬性,jqGrid有2種方法來處理唯一標識的需求:如果colModel中定義了key屬性爲true的列,則jqGrid將把所屬這個列的值作爲這行的id值;否則,jqGrid把行的順序號賦給id.
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.
如果您使用無意義的字段做爲數據行的主鍵,最好不要在grid中顯示它。而要在查詢中包含它,並且把它作爲行的id屬性傳遞給grid。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章