Forum


06:52

21/09/2009

I think of myself as a decent amateur programmer. I have done a good bit in php and perl. My experience is that whenever I venture into some other language I end up having frustrating problems that others have had also.
In looking through the posts on this forum, I see lots of help and lots of repeating questions from newbies like me. Sorry.
I want to access userdata and put it in a <div>. Right now I just want to get the data into an alert.
I am using xml to feed the data and the relevant portion (I think) looks like this:
<rows>
<page/>
<total>5</total>
<records>49</records>
<userdata name="index">15.0</userdata>
−
<row id="108">
<cell>10/01/08</cell>
<cell>91</cell>
<cell>67.6</cell>
<cell>111</cell>
<cell>23.8</cell>
<cell>Capitol Hill--The Senator</cell>
<cell>White</cell>
<cell/>
</row>
With the row information repeating
In my grid I have this:
var hi = $('#list').getGridParam('userData'); alert(hi.index);
The alert pops when the page is loaded and contains "undefined" and nothing else.
firebug reports:
(function($){$.jgrid=$.jgrid||{};$.exten...urn}return c.p.userData[b]}})})(jQuery);
I have looked at the docs here:
http://www.secondpersonplural.ca/jqgriddocs/_2ej16ksnu.htm
And earlier messages on this forum (including the earlier userdata: once again thread)
I am not sure if the xml and javascript shoud be userdata or userData or even if the capitlazation matters. Maybe the:
var hi = $('#list').getGridParam('userData'); alert(hi.index);
needs to be defined as a function itself.
Help please.
Bill
05:35

Moderators
30/10/2007

Hello,
If yiou call this immediate after the jqGrid - it will not work. Use gridComplete event for this purpose.
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.
11:28

21/09/2009

tim said:
Whats is the event you are using to call the function ?
tim
Tim, and Tony, your comments pushed me in the right direction. My usage of the userdata/userData (Tony seems strange naming but maybe that is your convention) is correct and is:
afterComplete:function(){ var theIndex= $('#list').getGridParam('userData'); $("#index").html(theIndex.index);}
I then put that code in the options for edit, add and delete and the index <div> in the page is updated with a revised number based on the revised grid. Here is the working example if anyone wants to see it:
http://billhogsett.com/deadloc...../login.php
Use username: demo1
password: demo59
The index will not show until there are 5 golf rounds in the grid and right now there is only 1. I'll add others soon.
Thanks for the help.
Bill
Most Users Ever Online: 715
Currently Online:
70 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.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66