Search code examples
dashcode

Dashcode Widgets Datasource


I would like to know if there is a Reference manual somewhere for Dashcode 3.0 Widgets' datasources.

I need to know the following:

  1. How to refresh (requery) a datasource
  2. How to listen for datasource events (onsuccess, onerror)
  3. How to pass parameter to datasource query

It's being very difficult for me to find this very basic information in Apple's documentation.

Thanks a lot.


Solution

  • To answer #3, to pass a parameter to the datasource query:

    ds = dashcode.getDataSource("mydatasource");
    ds.setValueForKeyPath("1", "parameters.count");
    ds.setValueForKeyPath("bar", "parameters.foo");
    

    will add ?count=1&foo=bar to the query URL.

    For #1, an answer I saw whilst searching this topic was to add an additional parameter which you change for each query to trigger a requery:

    ds.setValueForKeyPath(update++, "parameters.update");
    

    I still need to know the answer to #2 myself.