weixin_33717298 2014-01-07 22:02 采纳率: 0%
浏览 13

jQuery jqGrid文档

I am trying to learn the jQuery jqGrid and I must say, the docs are very sparse...

I went to the following link, but this is not helping much at all. http://www.trirand.com/blog/jqgrid/jqgrid.html

There must be some links out there (I've searched the web, but can't find any valid ones) that are conducive to loading and editing a grid for a .Net C# developer using Web Forms and Ajax.

I need to get the data via an Ajax call via a "stringify" on a DTO object (which I know how to do), then I need to serialize a that object back and pass it to the jqGrid. Before doing this last part, I believe I need to do some SQL Server manipulation as far as the number of rows to display, total number of rows, etc. which has me confused as well. I don't suppose that the jqGrid can handle this on its own like some of the 3rd party controls can...

I know how to serialize the json to a .Net object using Json.Net. The part that's giving me trouble is really all the setup involved with the actual loading of the data into the grid. Once there, then all the methods and events for editing and saving a row, etc.

Can somebody point me to some very good examples and or links?

After speaking to some other developers, they suggested to use the GridView client side grid instead of the jqGrid which is just not quite up to snuff as the GridView grid is. They informed me that the GridView is more powerful, yet easier to use than the jqGrid.

  • 写回答

1条回答 默认 最新

  • derek5. 2014-01-07 23:34
    关注

    Yes you are correct you need to do SQL/data operations before you pass that data back to jqgrid as json or XML, if you need server side pagination.

    Along with your json data in the root you should also send back the following properties:

    • total - total pages for the query
    • page - current page of the query (This will be returned back to the server from the client as well, when you click on the next button)
    • records - total number of records for the query
    • rows - an array that contains the actual data

    The above values can also be controlled using the jsonreader property when you pass as grid params:

    jsonReader : {
          root:"invdata",
          page: "currpage",
          total: "totalpages",
          records: "totalrecords"
          ....
    

    A sample JSON response would be:

    { 
      "total": "10", 
      "page": "2", 
      "records": "100",
      "users" : [
        {"id" :"1", "cell" :["cell11", "cell12", "cell13"]},
        {"id" :"2", "cell":["cell21", "cell22", "cell23"]},
          ...
      ]
    }
    

    http://www.trirand.com/jqgridwiki/doku.php?id=wiki:retrieving_data

    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题