开发者

What is the appropriate xml format for jqgrid userdata sent with rows ajax response?

开发者 https://www.devze.com 2023-04-06 01:59 出处:网络
I am trying to send custom data to initialize my jqgrid row selection.I want to send the selected row id in the userdata section of the jqgrid ajax xml response.

I am trying to send custom data to initialize my jqgrid row selection. I want to send the selected row id in the userdata section of the jqgrid ajax xml response.

Here is the xml snippet that I return:

<rows>
  <row> ...
  </row>
  <userdata>
    <selNodeId>64</selNodeId>
  </userdata>
</rows>  

When I ask for the the userData:

var userData = grid开发者_如何学CTree.getGridParam('userData')

Firebug shows a value of Object { null="64" }

jqgrid seems to parse the userdata xml and then throw away the 'selNodeId' identifier. Any ideas as to why the xml does not render an object with the proper 'selNodeId' property?


Look at the documentation. You will find that correct format for the userdata should be

<userdata name="selNodeId">64</userdata>

I recommend you if it's possible to use JSON format instead of XML. In the case almost any data can be read. With respect of jsonReader which contain methods instead of properties and jsonmap defined as function you can read practically any JSON data. The format of XML data as jqGrid input have too many restrictions.

0

精彩评论

暂无评论...
验证码 换一张
取 消