ImageVerifierCode 换一换
格式:DOCX , 页数:47 ,大小:25.07KB ,
资源ID:10904609      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10904609.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(JQGrid数据格式.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

JQGrid数据格式.docx

1、JQGrid数据格式Table of Contents Data Manipulation XML Data XML String XML Notes and Limitations JSON Data JSON String JSON dot notation Array Data Function User Data DiscussionData ManipulationWith the first release of jqGrid, the only possible way to obtain data was via xml as described in the tutorial

2、 above. Later, many people requested the ability to obtain data via JSON, then with an array and finally with real names. After lot of work and with the help of the community we now have a wide range of methods for obtaining data. The related options (in options array) for manipulating different typ

3、es of data are: datatype: the possible options are xml json jsonp local or clientSide xmlstring jsonstring script function ()It is very important to read this chapter, in order to understand how you should work with the data! The default mapping for xml data is as follows: jQuery(#gridid).jqGrid(. x

4、mlReader : root: rows, row: row, page: rowspage, total: rowstotal, records : rowsrecords, repeatitems: true, cell: cell, id: id, userdata: userdata, subgrid: root:rows, row: row, repeatitems: true, cell:cell ,.);If your server can provide data in this structure, you need to do nothing more; but if n

5、ot, there is a way (several ways) to handle the data you are given. See XML Data below. The default mapping for json data is as follows: jQuery(#gridid).jqGrid(. jsonReader : root: rows, page: page, total: total, records: records, repeatitems: true, cell: cell, id: id, userdata: userdata, subgrid: r

6、oot:rows, repeatitems: true, cell:cell ,.);In colModel, the related options are xmlmap for the description of an xml field, and jsonmap for the description of a json field. For example: jQuery(#gridid).jqGrid(. colModel : name:amount,., xmlmap:amt.,.);will cause jqGrid to search in the xml data for

7、an amt tag (when the repeatitems option is set to false. See below.). XML DataAs mentioned above, if we do not set the datatype and xmlReader parameter in the options array, the grid expects xml data, and the structure of this data is as described in our example. But what if we do not have the chanc

8、e to manipulate the server response? The solution to this problem is xmlReader, again with some additions in colModel. Here is a brief description of xmlReader. Important note: the rules of accessing the element from xml are the same as those used in jQuery library, i.e. CSS patterns. For more infor

9、mation refer to: http:/www.w3.org/TR/REC-CSS2/selector.html jQuery(#gridid).jqGrid(. xmlReader : root: rows, row: row, page: rowspage, total: rowstotal, records : rowsrecords, repeatitems: true, cell: cell, id: id, userdata: userdata, subgrid: root:rows, row: row, repeatitems: true, cell:cell ,.);Al

10、l the elements in the XML reader will be explained as examples rather than as strong description. root elementThe first setting here defines the root element. This describes where our data begins and all other loops begin from this element. For example, . true . data1 data2 data3 data4 data5 data6 .

11、 If we set the root element to “result” all data will be processed from there. In this case, because our rows are tagged and our cells tagged , all that is needed is to set jQuery(#gridid).jqGrid(. xmlReader: root:result ,.);The next element is the row element.This describes the information for part

12、icular row. Note that row must be a child of the root element. Here, if the xml looks like this, . true . data1 data2 data3 data4 data5 data6 . the setting to properly interpret this data would be jQuery(#gridid).jqGrid(. xmlReader: root:result, row:invoice ,.);The page total and recordselements des

13、cribe the information needed for the pager. These elements can be, but do not have to be, a child of the root element. For example, to interpret this data, . true . 1 10 20 data1 data2 data3 data4 data5 data6 . the xmlReader will have to look like this: jQuery(#gridid).jqGrid(. xmlReader: root:resul

14、t, row:invoice, page:invoicescurrentpage, total:invoicestotalpages, records:invoicestotalrecords ,.);The * repeatitems and * cell elements tells jqGrid that the information for the data in the row is repeatable - i.e. the elements have the same tag cell described in cell element. For this example, .

15、 true . 1 10 20 data1 data2 data3 data4 data5 data6 . the xmlReader will look like this: jQuery(#gridid).jqGrid(. xmlReader: root:result, row:invoice, page:invoicescurrentpage, total:invoicestotalpages, records:invoicestotalrecords, repeatitems:true, cell:invcell ,.);Next is the idelement. If repeat

16、items is set to true and key option in colModel is set to false the id, if present in xml data, must be a attribute of the row element. Lets look at the example: . true . 1 10 20 data1 data2 data3 data4 data5 data6 . In this case the xmlReader is: jQuery(#gridid).jqGrid(. xmlReader: root:result, row

17、:invoice, page:invoicescurrentpage, total:invoicestotalpages, records:invoicestotalrecords, repeatitems:true, cell:invcell, id : asin ,.);Lets suppose that the structure of the xml document returned from the server has the following format: . true . 1 10 20 12345 data1 data2 data3 data4 data5 data6

18、. where the tag describes the unique id and this should be set as the row id in the grid and not displayed in the grid. Following the rules we can construct the following: jQuery(#gridid).jqGrid(. xmlReader: root:result, row:invoice, page:invoicescurrentpage, total:invoicestotalpages, records:invoic

19、estotalrecords, repeatitems:false, id : asin ,.);and our colModel from the example should look like this:jQuery(#gridid).jqGrid(. colModel : name:invid, index:invid, width:55, xmlmap:invoiceno, name:invdate, index:invdate, width:90, xmlmap:invoicedate, name:amount, index:amount, width:80, align:righ

20、t, xmlmap:invoiceamount, name:tax, index:tax, width:80, align:right, xmlmap:invoicetax, name:total, index:total, width:80, align:right, xmlmap:invoicetotal, name:note, index:note, width:150, sortable:false, xmlmap:notes , xmlReader: root:result, row:invoice, page:invoicescurrentpage, total:invoicest

21、otalpages, records:invoicestotalrecords, repeatitems:false, id : asin ,.);We can use another trick. If the names in colModel are not important for you, you can do the following. jQuery(#gridid).jqGrid(. colModel : name:invoiceno, index:invid, width:55, name:invoicedate, index:invdate, width:90, name

22、:invoiceamount, index:amount, width:80, align:right, name:invoicetax, index:tax, width:80, align:right, name:invoicetotal, index:total, width:80, align:right, name:notes, index:note, width:150, sortable:false , xmlReader: root:result, row:invoice, page:invoicescurrentpage, total:invoicestotalpages,

23、records:invoicestotalrecords, repeatitems:false, id : asin ,.);In other words, jqGrid first looks to see if there is an xmlmap option available; if this option is not available the name is used as the xmlmap. But all of this is true only if the repeatitems element in xmlReader is set to false. The subgrid option is included in several of the xmlReader examples above. The principles in constructing the rules for this data are the same as those described above. More details about subgrids can be found in the section on Subgrids. XML StringThe xmlst

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1