cancel
Showing results for 
Search instead for 
Did you mean: 

Suply Function

Former Member
0 Kudos

Hi experts,

I have created a simple project and the Component Controller Context is like the following:


      Test                       // node       
         Sub                    // sub node, singleton and declared suply function
            SubValue         // attribute of SubTest, type is string
         TestValue1          // attribute of Test, type is integer
         TestValue 2         // attribute of Test, type is integer

I then mapped the context to View Context and defined two TextViews to display TestValue1 and TestValue2 in the View Layout.

I then defined another Textview to display the SubValue.

In the Component Controller Java Editor:

I set the TestValue1 and TestValue2 in wdDoInIt() mehtod.

I set the SubValue in SupplySub() method as follow:


    //@@begin supplySub(IWDNode,IWDNodeElement)
	  ISubElement thisEl = node.createSubElement();
	  thisEl.setSub1("Test");
	  node.addElement(thisEl);
    //@@end
 

When I deploy and run it, it displays TestValue1, TestValue2, and SubValue at once.

What I want is that it displays TestValue1 and TestValue2 first. After I click on TestValue1 or TestValue2, it then displays SubValue.

Am I missing something in this simply program.

Thanks for your help.

AnnaS

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Anna,

The code inside component controller is the first one to be executed. What is happening is, As soon as your component controller is initialized, you set the 3 values (in the init method of comp controller). Now since these values of the comp controller context are mapped to view context, and the view elements must be in turn bound to this view context, these values are instantly displayed.

What you want to do is, in the comp controller init method, set only the two values TestValue1 and TestValue2. Then in the view, create an OnActionSelect() event handler which should execute when you click any of the two TestValues.

In this method, You should get the comp controller reference and set 'subValue' in its context.

It should be then displayed in the third text field on your view.

In case my understanding of what you require is wrong, kindly revert.

Regards,

Anagha

Answers (1)

Answers (1)

Former Member
0 Kudos

Never mind about this question.