Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Add items to nested datasource

    Hi,

    I'm using smartGWT 2.5 version and would like to please for advice in following problem:

    There are master entity (Person) and nested entity that belongs to master entity (Order), in smartGWT they're represented in server restDataSources with operations and fields:
    Code:
    Order fields:
    DataSourceIntegerField orderId = new DataSourceIntegerField("id");
    orderId.setPrimaryKey(true);
    
    Person fields:
    DataSourceIntegerField personId = new DataSourceIntegerField("id");
    personId.setPrimaryKey(true);
    personDS.addField(personId);
    DataSourceTextField personName = new DataSourceTextField("name", "Name");
    personDS.addField(personName);
    
    DataSourceField orderField = new DataSourceField();
    orderField.setName("order");
    orderField.setTypeAsDataSource(orderDS);
    personDS.addField(orderField);
    I create both records in 1 Dynamic form and want to also save it 1 request:
    Code:
    data: {
       fields: {
          name: "Test",
          order: {...}
    }}
    I'm able to crate such request after calling form.saveData(), the problem is that created person is sucessfully added to person's datasource cache and I see it in other widget that have that datasource (for example tables) but created order is not added to order datasource cache and widget that shows orders aren't refreshed with this new item.

    Is there any way to achieve correct synchronization both datasources after response of add data or there is necessary create 2 requests on server?

    thanks
Working...
X