user590586
user590586

Reputation: 3050

jqgrid load specific rows from xml string

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.

Upvotes: 0

Views: 770

Answers (1)

Oleg
Oleg

Reputation: 221997

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.

Upvotes: 1

Related Questions