populating a datagrid fails in simulator
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
populating a datagrid fails in simulator
Hi All,
I'm quite new to liveCode so this may well be that I'm missing something obvious! I've got an app the pulls data from a web service, drops it into a field, splits it into chunks then populates a datagrid with the chunks. All works fine in Livecode itself but when I test this in the iPhone simulator (ios 4.1) the datagrid fails to get populated. I can see the data coming in from the web service so I've narrowed the problem down to the data actually being added to the datagrid - I have a separate button that puts an empty array into the datagrid and this fails as well.
The datagrid itself displays fine in the simulator - i.e. if I populate the datagrid in livecode, save the app then run it in the simulator the data shows up.
I need to use a datagrid because the data contains icons as well as text so it appears to be the best control to lay out the kind of data I'm working on.
Any suggestions gratefully received!
I'm quite new to liveCode so this may well be that I'm missing something obvious! I've got an app the pulls data from a web service, drops it into a field, splits it into chunks then populates a datagrid with the chunks. All works fine in Livecode itself but when I test this in the iPhone simulator (ios 4.1) the datagrid fails to get populated. I can see the data coming in from the web service so I've narrowed the problem down to the data actually being added to the datagrid - I have a separate button that puts an empty array into the datagrid and this fails as well.
The datagrid itself displays fine in the simulator - i.e. if I populate the datagrid in livecode, save the app then run it in the simulator the data shows up.
I need to use a datagrid because the data contains icons as well as text so it appears to be the best control to lay out the kind of data I'm working on.
Any suggestions gratefully received!
-
- Posts: 8
- Joined: Sat Nov 20, 2010 2:32 am
Re: populating a datagrid fails in simulator
i am having this problem as well, is not possible as of yet?
-
- VIP Livecode Opensource Backer
- Posts: 243
- Joined: Sun Dec 06, 2009 12:24 am
- Location: Fredericktown, MO
- Contact:
Re: populating a datagrid fails in simulator
Check the other DG post here...
Re: populating a datagrid fails in simulator
Hi Stanier,
could you post here an example code to consume a SOAP WS in livecode? I have 4 parameters in my WS with one method, but I don´t know how to implement a request and response code.
Thanks
could you post here an example code to consume a SOAP WS in livecode? I have 4 parameters in my WS with one method, but I don´t know how to implement a request and response code.
Thanks
stanier25 wrote:Hi All,
I'm quite new to liveCode so this may well be that I'm missing something obvious! I've got an app the pulls data from a web service, drops it into a field, splits it into chunks then populates a datagrid with the chunks. All works fine in Livecode itself but when I test this in the iPhone simulator (ios 4.1) the datagrid fails to get populated. I can see the data coming in from the web service so I've narrowed the problem down to the data actually being added to the datagrid - I have a separate button that puts an empty array into the datagrid and this fails as well.
The datagrid itself displays fine in the simulator - i.e. if I populate the datagrid in livecode, save the app then run it in the simulator the data shows up.
I need to use a datagrid because the data contains icons as well as text so it appears to be the best control to lay out the kind of data I'm working on.
Any suggestions gratefully received!
Re: populating a datagrid fails in simulator
Hi
This was driving me bananas.
Solution
On card 1 of your stack place a datagrid and hide it.
It will then work.
Go figure.
This was driving me bananas.
Solution
On card 1 of your stack place a datagrid and hide it.
It will then work.
Go figure.
-
- Posts: 6
- Joined: Tue Apr 08, 2014 9:12 pm
Re: populating a datagrid fails in simulator
I'm having similar problem: datagrid being populated fine in LiveCode, but fails in iOS simulator.
The data is coming from an API.
I have tried the recommendation of putting a datagrid on card 1 and hiding it, but that didn't work.
Any recommendations for iOS apps that want to use a datagrid?
Thanks,
Jon
The data is coming from an API.
I have tried the recommendation of putting a datagrid on card 1 and hiding it, but that didn't work.
Any recommendations for iOS apps that want to use a datagrid?
Thanks,
Jon
Re: populating a datagrid fails in simulator
I'm not surprised - that's voodoo.altschuler.jon wrote: I have tried the recommendation of putting a datagrid on card 1 and hiding it, but that didn't work.
Tell us more about the format of the data, the kind of data grid and perhaps show us the script you are trying to debug. It's hard to help when someone just says "it doesn't work".
Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.
Former LiveCode developer.
Now recovering.
Re: populating a datagrid fails in simulator
When using the simulator, it's handy to use 'answer' commands in troublesome scripts to report back the value of variables, which arm of an 'if' statement is being followed or anything else that might track down the problem.
-
- Posts: 6
- Joined: Tue Apr 08, 2014 9:12 pm
Re: populating a datagrid fails in simulator
When you open the card with the datagrid, i load the API url:
When the file is down loading, i manipulate the array to be cleaner for the datagrid. The repeat loop could be my problem, but I haven't found a better way to get the array into the datagrid successfully.
In the datagrid behavior script:
Code: Select all
on OpenCard
put "there is a URL here but I can't seem to include in the forum post" into theURL
load URL theURL with message "FileIsDoneDownloading"
end OpenCard
Code: Select all
on FileIsDoneDownloading pURL, pURLStatus
if pURLStatus is "cached" then
## set the text of field "fld_result" to URL pURL
put URL pURL into tAllCoins
## put the results of the API call into an array
put jsonToArray(tAllCoins, true) into gCoinListArray
put gCoinListArray[results][collection1] into gCoinListArray
## put the array into dataGrid format
repeat with x = 1 to (item 2 of line 1 of the extents of gCoinListArray)
put gCoinListArray[x]["coinID"]["text"] into gCoinListData[x]["coinID"]
put gCoinListArray[x]["icon"]["src"] into gCoinListData[x]["icon"]
end repeat
set the dgData of group "dgCoinList" to gCoinListData
## clear cache when done
unload url pURL
else
put libURLErrorData(pURL) into theError
set the text of field "fld_error" to "An error occurred:" && theError & "."
end if
end FileIsDoneDownloading
Code: Select all
on FillInData pDataArray
set the text of field "coinID" of me to pDataArray["coinID"]
set the filename of image "icon" of me to pDataArray["icon"]
end FillInData
-
- Posts: 6
- Joined: Tue Apr 08, 2014 9:12 pm
Re: populating a datagrid fails in simulator
OK, problem solved, sort of.
Basically I was using the load command with a callback script that uses "pURLStatus" which apparently is only useable on desktop. On mobile you need to use a callback script of "on urlProgress".
FACEPALM.
J
Basically I was using the load command with a callback script that uses "pURLStatus" which apparently is only useable on desktop. On mobile you need to use a callback script of "on urlProgress".
FACEPALM.
J