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_Related Related Topics sp_TopicIcon
Subgrid data not loading
Tags: subgrid
15/03/2013
16:37
Avatar
olefrank
New Member
Members
Forum Posts: 2
Member Since:
14/03/2013
sp_UserOfflineSmall Offline

I'm new to JqGrid. I'm trying to make a grid with products. For each product I want a subgrid showing orders.

I can't load data in the subgrids. The 'load_sub_data_json.php' is never loaded...

Here's the JS my HTML file:

<pre> jQuery(document).ready(function() { $("#list").jqGrid({ height: 'auto', blockui: true, altRows: true, loadonce: true, url:'load_main_data_json.php', datatype: 'json', mtype: 'GET', colNames:['ProductCode','ProductName', 'ProductVendor'], colModel :[ {name:'productcode', index:'productcode', width:100, align:'right'}, {name:'productname', index:'productname', width:280, align:'right'}, {name:'productvendor', index:'productvendor', width:200, align:'right'} ], rowNum:35, rowList:[25,50,75,100,125,150,175,200], sortname: 'productcode', sortorder: 'desc', viewrecords: true, caption: 'My first grid', subGrid: true, subGridUrl: 'load_sub_data_json.php', subGridModel: [ { name : ['Order number','Order date','Shipped date','Comments'], index : ['orderNumber', 'orderDate', 'shippedDate', 'comments'], width : [55,100,100,200], align : ['right','right','right','right'], params: ['productcode'] } ] }); }); </pre>

And this is my php-file loading data to the subgrid:

<pre> include("dbconfig.php"); $id = $_REQUEST['id']; $productCode = $_REQUEST['productcode']; // param passed by query // connect to the database $db = mysql_connect($dbhost, $dbuser, $dbpassword) or die("Connection Error: " . mysql_error()); // select database mysql_select_db($database) or die("Error conecting to db."); // select columns $SQL = "select o.orderNumber, o.orderDate, o.shippedDate, o.comments from orderdetails d inner join orders o on o.orderNumber = d.orderNumber where d.productcode='" . $id. "';"; $result = mysql_query( $SQL ) or die("CouldnÂ’t execute query.".mysql_error()); $response = new stdClass; $i=0; while($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $response->rows[$i]['id']=$row['orderNumber']; $response->rows[$i] ['cell']=array($row['orderNumber'],$row['orderDate'],$row['shippedDate'],$row['comments']); $i++; } echo json_encode($response); </pre>
Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
23 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