+2
Є відповідь
Can you provide a quick little JSON building 101?
I'm playing around with the datasource add property to build a local datasource from a remote one. (Thanks, Adam!) But I'm having some trouble. Can you give me the most stripped down example of a WIRE that adds to a local JSON file?
(I'm mostly interested in the datasource line referencing the local file at the top of the WIRE, as well as where exactly the ".add" property sticks the code within the local file.)
Thanks!
(I'm mostly interested in the datasource line referencing the local file at the top of the WIRE, as well as where exactly the ".add" property sticks the code within the local file.)
Thanks!
Служба підтримки клієнтів працює на UserEcho
[eval] statements
blocks
dataSourceResultCount
querycomplete
Enjoy and happy coding.
http://www.moderndukes.com/post/42320...
A couple questions:
- My new resident datasource is stored on the device, so it acts like [preferences:] rather than a [var:], right? Meaning the data is still stored when the app is closed and should not need to be downloaded again when the app is reopened? (Assuming no change in the original datasource.)
- Similarly: to clear out my resident datasource, I should use .removeIndex, right? Basically the same process as building the datasource, just in reverse?
This is good stuff.
The other thing to remember, any time that the master feed is requeried and you have your action that is building your new custom datasource will trigger the action again.
To clear out your datasource, you can do a quick little trick of just reseting your query on the new, custom datasource and it will blank out any attached list/tableviews/objects.
<assign property="datasource:customJSON.query" value="//xxyyzz" />
Another note, you can actually assign cache durations per datasource. So in your wire you can have two (or more) datasources with different caching values.
<datasource name="origin" source="" query="//sweet" providertype="json" urlcacheduration="259200" />
<datasource name="custom" source="" query="/sweeter" providertype="json" urlcacheduration="86400" >