I am trying to access userdata I have sent from the server (using coldfusion) to filter the display of edit or add icons depending on users’s role. Example of userdata value is “all” or “add” or “edit” or “view”.
From firebug an example of userdata looks like
,"USERDATA":"all"
The jsonreader looks like this
jsonReader: {
root: "ROWS", //our data
page: "PAGE", //current page
total: "TOTAL", //total pages
records:"RECORDS", //total records
userdata: "USERDATA",
cell: "", //Not Used
ar_bill_key: "0",//Will default to first column
id:"10"
},
I am trying to find the userdata so I can figure out how to use it. The code below returns undefined in firebug. I’m new to this so it’s not set up correctly. Any advice would be appreciated. I have looked at and tried many examples but it’s not working yet
loadComplete:jQuery("#List").getGridParam("userdata")
alert("userdata")
Thanks
You have some errors. The first one is: the name of parameter is
'userData'and not'userdata'. So to get the value send from the server you should useThe next error: the
loadCompleteis a callback function so the codeis wrong.
The last error is: the value of
userdatawhich will be sent from the server have to be object. So you should place something likeinstead or
If you use
then you can display the value from
loadCompletelike the following: