cancel
Showing results for 
Search instead for 
Did you mean: 

Master-Detail

Former Member
0 Kudos

Hello,

I have created following context-nodes, representing master-detail data:

ParentElement (cardinality=0..n, singleton=true)

-


id (Attrbute)

-


ChildElement(cardinality=0..n, singleton=false)

-


name (string Attribute)

-


value (string Attrbute)

I have created 2 tables in order to show master and it's detail data. So far so good.

Now my problem: i initialize context with some data, and this data is shown in my master + detail tables!

But if i change detail-data in detail-table, the context doesn't change it old values. Have somebody exprienced the same problem? I mean the data is shown, but cannot be edited.

With best regards

Michael Belenki

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Michael,

no this should work. Assume a singleton value node "Master" with attributes Id and Name on root level of the context and Master having a non singleton child value node "Detail" with attributes DetailId and DetailName, then after filling in wdDoInit():

IPrivate<YourView>.IMasterNode mNode = wdContext.nodeMaster();

for (int ix = 0; ix < 10; ix++) {
  IPrivate<YourView>.IMasterElement mel = mNode.createMasterElement();
  mNode.addElement(mel);
  mel.setId(ix);
  mel.setName("Master " + ix);
  
  for (int jx = 0; jx < 5; jx++) {
    IPrivate<YourView>.IDetailElement del = mel.nodeDetail().createDetailElement();
    mel.nodeDetail().addElement(del);
    del.setDetailId(ix * 10 + jx);
    del.setDetailName("Detail " + ix * 10 + jx);
  }
}

and binding the master table's dataSource to node "Master" and the detail's table dataSource to node "Master.Detail" the entries in the detail table are editable (using Inputfields of course).

Hope that helps.

Best regards

Stefan