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
Problem getting the row id
10/04/2009
09:39
Avatar
son
New Member
Members
Forum Posts: 2
Member Since:
10/04/2009
sp_UserOfflineSmall Offline

i am using the jqgrid example and added the onSelectRow to run some javascript code but I get undefined id and it can't find the row id even though I set the key and even set the row id in the server php code.

Here's the code:

jQuery(”#bigset”).jqGrid({

url:'bigset.php',

datatype: “json”,

height: 150,

colNames:['Index','Name', 'Code'],

colModel:[

{name:'id',index:'item_id', key:true, width:65},

{name:'item_name',index:'item_name', width:150},

{name:'item_cd',index:'item_cd', width:100}

],

rowNum:5,

//rowList:[10,20,30],

imgpath: 'themes/basic/images',

mtype: “GET”,

pager: jQuery('#pagerb'),

sortname: 'item_id',

viewrecords: true,

sortorder: “asc”,

onSelectRow: function() {alert(id);}

});

This is the section in php that sets the row id



while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {

$responce->rows[$i]['id']=$row[item_id];

$responce->rows[$i]['cell']=array($row[item_id], $row[item_name],$row[item_cd]);

$i++;

}

Your help will be highly appreciated.

Son 

14/04/2009
02:49
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

Hello,

If you set key:true, you do not need to provide the id from server.

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.

15/04/2009
15:23
Avatar
son
New Member
Members
Forum Posts: 2
Member Since:
10/04/2009
sp_UserOfflineSmall Offline

Tony,

Thank you for our reply.

Actually, I got it a few days agobut just got the chance to respond now.

I didn't put the 'id' in the function(id) when before called by the alert(id).

Son

16/04/2009
04:50
Avatar
redsuitee
Member
Members
Forum Posts: 35
Member Since:
16/04/2009
sp_UserOfflineSmall Offline

key:true?
what is the effect if use it?

"God Gave you a gift of 86,400 seconds today.
Have you used one to say thank you?"

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

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