tags:

views:

75

answers:

1

I am trying to get started with SmartGwt. I am using the XJSONDatasource to make a cross-domain call to an example page at SmartClient that has JSON data. When I run the code, however, a popup comes up that says "Finding Records that match your criteria..." This never goes away, and the data is not loaded. I am using the free version of SmartGwt (my company has said that this is what we'll use). Hoping I'm just missing something obvious.

    DataSource dataSource = new XJSONDataSource();
    dataSource.setDataTransport(RPCTransport.SCRIPTINCLUDE);
    dataSource.setDataFormat(DSDataFormat.JSON);

    dataSource.setDataURL("http://www.smartclient.com/smartgwt/showcase/data/dataIntegration/json/contactsData.js");
    DataSourceTextField nameField = new DataSourceTextField("name", "name");

    nameField.setValueXPath("name");

    dataSource.setFields(nameField);

    ListGrid grid = new ListGrid();
    grid.setDataSource(dataSource);
    grid.setWidth100();
    grid.setHeight(100);
    grid.setAutoFetchData(true);
    grid.draw();
A: 

I see from the docs here: http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/data/XJSONDataSource.html

Note, as indicated in the tutorial above, the server is responsible for writing out not just the data, but also a JavaScript function call that tells the client that the response has arrived. The client passes the name of the function to call as the "callback" URL parameter.

But there is no such callback in the code at the page you link at www.smartclient.com/smartgwt/showcase/data/dataIntegration/json/contactsData.js

Lenz