0
votes

I have my columns set as follows:

colModel : [
                {display: 'column1', name : 'column1', width : 200, sortable : true, align: 'center'},
                {display: 'column2', name : 'column2', width : 100, sortable : true, align: 'left'},
                {display: 'column3', name : 'column3', width : 100, sortable : true, align: 'left'},
                {display: 'column4', name : 'column4', width : 300, sortable : true, align: 'left'},
            ],

I set my data source to a url that returns xml. The xml is like this:

<?xml version="1.0"?>
<items_list>
  <item>
    <column1>BlahBlah</column1>
    <column2>BlahBlah</column2>
    <column3>BlahBlah</column3>
    <column4>BlahBlah</column4>
  </item>

  <item>
    <column1>BlahBlah</column1>
    <column2>BlahBlah</column2>
    <column3>BlahBlah</column3>
    <column4>BlahBlah</column4>
  </item>
</items_list>

How can I bind the grid to the xml datasource, it doesn't appear to recognize it as it is?

2

2 Answers

1
votes

flexigrid expects xml to be formatted in a specific way like this

  <?xml version="1.0" encoding="utf-8"?>
  <rows>
    <page>1</page>
    <total>2</total>
    <row id='1'>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[123]]></cell>
        <cell><![CDATA[123]]></cell>
    </row>
    <row id='2'>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[abc]]></cell>
        <cell><![CDATA[123]]></cell>
        <cell><![CDATA[123]]></cell>
    </row>
  </rows>
-1
votes

it doesn't work because flexigrid won't accept formatted xml

you will need to strip out tabs and en of line characters.