开发者

jqgrid load specific rows from xml string

开发者 https://www.devze.com 2023-02-12 16:38 出处:网络
I have a grid which load it\'s content from xml string (editurl: \"clientArray\",datatype: \'xmlstring\').

I have a grid which load it's content from xml string (editurl: "clientArray",datatype: 'xmlstring').

Is it possible to select the rows i want the grid to load according to the value inside the xml string? (for example:

<root>
<row>
    <number>1</number>
    <test>546</test>
    <i_u>1</i_u>
</row>
<row>
      <number>2</number>
    <test>543</test>
    <i_u>2</i_u>
</row>
<row>
      <number>4</number>
    <test>544</test>
    <i_u>2</i开发者_高级运维_u>
</row>
<row>
      <number>5</number>
    <test>545</test>
    <i_u>1</i_u>
</row>

I want the grid to show only the rows where "i_u" tag is with the value of 1.

If possible , how can this be done?

Thank's In Advance.


You don't included the jqGrid definition in your question, so the context is not clear where you use it. Moreover in the text of you question you use "load", "select" and "show" verbs to describe what you need. All from there is possible.

If you need only display selected strings having i_u="1", you can follow the answer and the answer to define search:true and postData parameters to force filtering of data. Important is only that if you has additional "Search" and "Refresh" buttons in the navigator bar, that the user will be able to reset the filter and to see all the rows. If you don't has the buttons the user will see only the subset of data corresponds to the filter from the postData parameter.

Look the demo.

If you need really load the data having i_u="1" you should modify the XML data for example with respect of jQuery to remove all <row> elements having as direct children i_u !== "1". After the modification you can use the data as input for jqGrid.

0

精彩评论

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