Skip to Content
avatar image
Former Member

Need help with Context and UI

Hello,

I am getting employees details from a certain repository

Each employee details contain the following info - ID, Name and Address.

I would like to create the following UI for it:

A DropDown by Key which will contain the employees IDs.

Each selection of an ID shows the relevant employee details on Text Views.

In order to acheive this I've created the relevant UI and this Contex:

At the context root I've created a Context Node called AllEmployees and inside it I've created an ID ttribute (called employeeID) Aand a Context Node with cardinality 1...1 by the name Details which contains the Name and Address Attributes.

I bounded each UI to it's relevant Context and initialized it like this:

I

PrivateMainView.IAllEmployeesElement newEmployee;
PrivateMainView.IDetailsElement newDetails;
	 
ISimpleTypeModifiable idType = wdThis.wdGetAPI().getContext().getModifiableTypeOf("AllEmployees.employeeID");

IModifiableSimpleValueSet idValues = idType.getSVServices().getModifiableSimpleValueSet();
	 
while(...)
{
newEmployee = wdContext.createAllEmployeesElement();
newEmployee.setEmployeeID(id);
idValues.put(id,id);
						
wdContext.nodeAllEmployees().addElement(newEmployee);
newDetails = wdContext.createDetailsElement();
newDetails.setName(name);
newDetails.setAddress(address);
newEmployee.nodeDetails().bind(newDetails);
}

The result is that the DropDown contains the IDs but selecting and ID doesn't result in showing the relevant details on the Text Views.

Can anyone please help me with that?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 02, 2005 at 06:25 AM

    Hi,

    Use DropDownByIndex instead of DropDownByKey and use manke the childNode singleton to true.

    Regards,

    Sowjanya.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Much clearer, 10X.

      And thank you all again for your great help and support, you amaze me each time with your deep knowledge and tolerance! 😊

  • avatar image
    Former Member
    Jun 02, 2005 at 06:27 AM

    cant u have the Name and Address Attributes in the All Employees Node itself and then for each instance of that u can have it generated so that onAction of that u can call that partocular node instance and display the Values

    This is just a thinking.

    Wishes

    Krishna kanth

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 02, 2005 at 06:44 AM

    Hi,

    What u are doing here is creating elements and populating the node. This will just populate the dropdown..

    When u select a particular value in a dropdown it will become the currentnodeelement.

    For displaying corresponding values do the following:

    1. create a action for onSelect

    2. INside that if textview is assigned to attr textdata

    wdContext.currentContextelement.setTextdata(wdCOntext.node<name>.currentnode<element>.get<val>());

    Can u get wat i am saying!

    Regards

    Bharathwaj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I can see what the problem is:

      When I go to the current element of AllEmployees I am able to get the current ID but when I go to it's sub-node Details I get the Name and the Address of the last populated element which means that selecting an ID doesn't update the Details element. It seems like they are not bound to each other although I bound them at the code. Any ideas...?