Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Join JSON Data

$
0
0
SmartClient v9.0p_2014-02-20

I am trying to join two data sources with data loaded from a .json file.

Code:

isc.DataSource.create({
  id: "person",
  fields: [
      { name: "id", primaryKey: true },
      { name: "name" }
  ],
  dataURL: "people.json",
  dataFormat: "json"
});

isc.DataSource.create({
  id: "order",
  fields: [
      { name: "id", foreignKey: "person.id", hidden: true },
      { name: "customer", includeFrom: "person.name" }
  ],
  dataURL: "orders.json",
  dataFormat: "json"
});

When I create a ListGrid using the "order" DataSource, the customer column is blank. Watching the network requests, the "people.json" file is never loaded.

Am I missing anything?

The reference docs say
"If both DataSources are SQLDataSources, HibernateDataSources or JPADataSources (with Hibernate as the provider) the related data will be retrieved via a SQL join and criteria and sort directions applied to the field work normally (they become part of the generated SQL query).

Otherwise, the related data will be retrieved via performing a DSRequest against the related DataSource once the data from the primary DataSource has been retrieved. In this case, criteria or sorting directions applied to the included field are only allowed if data paging is not in use (for example ListGrid.dataFetchMode:"basic"); otherwise, criteria and sort direction are ignored for the included field and a warning is logged on the server."

Which sounds like this should work even if they are not SQL, Hibernate or JPA DataSources.

Viewing all articles
Browse latest Browse all 4756

Trending Articles