Treeview problem popuplating

Playing with the treeview trying to display customer, order and orderdetail info from the example data.

  1. Created a form to display/edit customer info. Works fine.

  2. Added a tree view to show customer->order # using the code below and it works fine.
    cust1
    1234
    1235
    cust2
    1236
    1237…etc

var custbind = elements.clientorderstree.createBinding(server,‘customers’);
custbind.setTextDataprovider(‘customerid’);

var ordersbind = elements.clientorderstree.createBinding(server,‘orders’);
ordersbind.setTextDataprovider(‘orderid’);

custbind.setNRelationName(‘customer_orders’); //customers->orders relation
ordersbind.setNRelationDataprovider(‘customer_orders’);

elements.orderstree.removeAllRoots()
elements.clientorderstree.addRoots(foundset);

  1. Added a tree view to show order->productid for the currently selected customer on the form and I cant get the productid to show. The orders for the current customer shows fine, but the order detail nodes shows empty info corresponding to the correct number of line items. The code below is fired via the form’s onRecordSelection event.

current customer:cust1

1234
blank
blank
1235
blank
blank
blank…etc

var ordersbind = elements.orderstree.createBinding(customer,‘orders’);
ordersbind.setTextDataprovider(‘orderid’);

var detailsbind = elements.orderstree.createBinding(server,‘orderdetails’);
detailsbind.setTextDataprovider(‘productid’);

ordersbind.setNRelationName(‘orderlineitems’); //orders->orderdetail relation
detailsbind.setNRelationDataprovider(‘orderlineitems’);

elements.orderstree.removeAllRoots();
elements.orderstree.addRoots(customer_orders); //customers->orders relation

What am I doing wrong?

Thanks!

I fixed it by removing the setNRelationDataprovider statements.