[ 3 posts ]

Andrew Martin

  • Username: Android
  • Joined: Wed Nov 04, 2009 6:34 am
  • Posts: 2
  • Offline
  • Profile

Trouble Binding JSON Service to Datatable

Post Posted: Thu Nov 05, 2009 6:05 am
+0-
Hi All,

I'm a bit new to YUI. I am trying to bind a .NET WCF JSON web service to the YUI datatable but no luck. I can get an XML service to bind with no problem. The following is what the service returns.

Code:
{ "Rows" :[{"EmpId":"0","Name":"A","Designation":"Manager","Department":"Mech","Country":"India"},{"EmpId":"1","Name":"B","Designation":"Team Leader","Department":"Mech","Country":"India"}]}


This JSON seems to parse fine in jsonlint, also if I make a YAHOO.util.Connect.asyncRequest I can parse the above json into an js array by calling YAHOO.lang.JSON.parse() on the success function's parameter.responseText. Parse gives me the following array.

Code:
-      var test
-         Rows
-            [0]
               Country             "India"
               Department        "Mech"
               Designation       "Manager"
               EmpId               "0"
               Name                "A"
-            [1]
               Country             "India"
               Department       "Mech"
               Designation       "Team Leader"
               EmpId               "1"
               Name               "B"


Now when I try to use a Datasource and fill a Datatable I'm getting a "Data Error" message each time. I know that it is hitting the service and returning properly because the service running in debug mode and it hits a breakpoint whenever I load this page. I've included the entire page below. Thanks in advance for any advice you can provide.

http://gist.github.com/227051

Thanks,
Andy

Satyam

YUI Contributor

  • Username: Satyam
  • Joined: Tue Dec 09, 2008 12:34 am
  • Posts: 2016
  • Location: Sitges, Spain
  • GitHub: Satyam
  • Gists: Satyam
  • IRC: DevaSatyam
  • YUI Developer
  • Offline
  • Profile

Re: Trouble Binding JSON Service to Datatable

Post Posted: Thu Nov 05, 2009 6:50 am
+0-
For JSON, it is not responseSchema.resultNode but resultsList

Andrew Martin

  • Username: Android
  • Joined: Wed Nov 04, 2009 6:34 am
  • Posts: 2
  • Offline
  • Profile

Re: Trouble Binding JSON Service to Datatable

Post Posted: Thu Nov 05, 2009 7:01 am
+0-
Thanks so much!

:oops:
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum