Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
loading xml data from remote php script not working
07/01/2010
01:18
Avatar
dhruvg
Guest
Guests

Hi, I am new to jqGrid and am trying to get a simple grid which loads xml data from a php script to work. I have tried to model my code off the demos as close as possible, but for some reason, the actual data is not being displayed. Only the table, css, and the column names are being displayed..

Here is my XML output:

<?xml version='1.0' encoding='utf-8'?>
<rows>
	<page>1</page>
	<total>1</total>
	<records>4</records>
	<row id='1'>
		<cell><![CDATA[1]]></cell>
		<cell><![CDATA[test]]></cell>
		<cell><![CDATA[19]]></cell>
		<cell><![CDATA[test]]></cell>
		<cell><![CDATA[CA]]></cell>
		<cell><![CDATA[email]]></cell>
		<cell><![CDATA[1]]></cell>
	</row>
	<row id='2'>
		<cell><![CDATA[2]]></cell>
		<cell><![CDATA[bob]]></cell>
		<cell><![CDATA[22]]></cell>
		<cell><![CDATA[test']]></cell>
		<cell><![CDATA[MA]]></cell>
		<cell><![CDATA[phone]]></cell>
		<cell><![CDATA[2]]></cell>
	</row>
	<row id='3'>
		<cell><![CDATA[3]]></cell>
		<cell><![CDATA[Matt]]></cell>
		<cell><![CDATA[20]]></cell>
		<cell><![CDATA[test]]></cell>
		<cell><![CDATA[TX]]></cell>
		<cell><![CDATA[bloop]]></cell>
		<cell><![CDATA[3]]></cell>
	</row>
	<row id='4'>
		<cell><![CDATA[4]]></cell>
		<cell><![CDATA[blah]]></cell>
		<cell><![CDATA[19]]></cell>
		<cell><![CDATA[poker]]></cell>
		<cell><![CDATA[CA]]></cell>
		<cell><![CDATA[phone]]></cell>
		<cell><![CDATA[4]]></cell>
	</row>
</rows>

Here is the javascript code that makes the grid:
  	
	// construct the grid
	$("#datagrid").jqGrid({
	   	url: data_url,
		datatype: "xml",
	   	colNames: col_name_array,
	   	colModel: col_model,
	   	rowNum: 10,
	   	autowidth: true,
	   	rowList:[10,20,30],
	   	pager: $('#pager'),
	   	sortname: 'bytefalcon_id',
	    viewrecords: true,
	    sortorder: "asc",
	    caption: datagrid_name,
	    mtype: 'GET'
	}).navGrid('#pager',{edit: false, add: false, del: false});
I have included the following scripts in the head:
  <script type="text/javascript" src="/static/js/jquery-1.3.2.min.js"></script>
  <link rel="stylesheet" type="text/css" media="screen" 
	href="/static/css/redmond/jquery-ui-1.7.2.custom.css"></link>
  <link rel="stylesheet" type="text/css" media="screen" href="/static/css/ui.jqgrid.css"></link>
  <script src="/static/js/i18n/grid.locale-en.js" type="text/javascript"></script>
  <script src="/static/js/jquery.jqGrid.min.js" type="text/javascript"></script>
  <script src="/static/js/src/jqDnR.js" type="text/javascript"></script>
I have verified that the col_name_array, col_model, and datagrid_name all have correct values. Plus, this is 
the only way the grid can be shown anyways and the grid is being shown properly. The problem is that the 
xml data is not being populated in the grid. The data_url points to the script which correctly outputs the 
xml data above. Again,

I have verified this by logging the GET message and the output..
Anyone have any ideas what is missing? Why isn't this working?
Thanks in advance.

07/01/2010
01:48
Avatar
dhruvg
Guest
Guests

I went a step further and copy/pasted the code from the jqgrid demo for loading xml data. I changed the url property from 'server.php?q=1' to http://www.trirand.com/blog/jq.....er.php?q=1 and if i understand this correctly, jqgrid will use teh other properties provides and create a url like the following: http://www.trirand.com/blog/jq.....;sord=desc

This url outputs the xml data which is populated in the grid in the demo at least. THe funny thing is that I do the exact same thing as the demo and call this url for the xml data. Even now, only the table, column names, and css/styling is displayed. The xml data from the above url is NOT populated into the grid.

This makes me think that hte issue is not with the server side code but the client-side code. However, I have no clue where to begin since even the demo javascript code and xml output is not working for me!

Any help greatly appreciated.

Thanks in advance,

07/01/2010
20:54
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Could yo please post your jqGrid configuration or provide a link to the problem.

Regards

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
50 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information