cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically assigning OVS controller to an input field

Former Member
0 Kudos

Hi All,

I have a requirement in my project where i need to assign different OVS controllers to a single field depending on a value selected from another field. There will be a table which has 5 or 6 columns. The first field is a dropdown and depending on the value selected in column 1 i need assign a different OVS controller to the input field in column2. Is it possible to do this?

Regards

Prakash

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Yes, we can do this.

1. Create the required no.of OVS Custom controllers

2. Create a common method (ex: bindOVSController() ) in View controller

In this method follow the below steps

a.Get the current drop down value from your first column

b.Get the attribute info, which bind to inputput field in your second column

ex: IWDAttributeInfo[] orgAttrInfoArr = {wdContext.nodeEmpData().getNodeInfo().getAttribute("Role")};

c. Check your drop down value and add the OVS extension to the attribute

ex: swith(selectedIndex) {

case 0 :

IWDOVSContextNotificationListener listener = wdThis.wdGetOVSCustControllerController().getOVSListener(); WDValueServices.addOVSExtension("Select Role from 1",orgAttrInfoArr, wdThis.wdGetOVSCustControllerController().getOVSInputNode(), wdThis.wdGetOVSCustControllerController().getOVSOutputNode(), listener);

break;

case 1 :

IWDOVSContextNotificationListener listener = wdThis.wdGetOVSCustControllerController2().getOVSListener(); WDValueServices.addOVSExtension("Select Role from 2",orgAttrInfoArr, wdThis.wdGetOVSCustControllerController2().getOVSInputNode(), wdThis.wdGetOVSCustControllerController2().getOVSOutputNode(), listener);

break;

}

Based on your selected drop down index it will assign the corresponding OVS controller and fetch the data.

I could solve this problem in my example. Let me know if you have any clarification.

Thanks

Former Member
0 Kudos

Hi Tatayya,

Thanks for the response. I had a question.

For e.g in my first row i select value 1 from the first cell and i get ovs1 in my second column. Wht will happen when in my second row when i select value2. I assume i will get ovs2 in the second column. Wht will happen when i go back to row one second column and click the OVS there. will i get OVS1 there or OVS2.

Regards

Prakash

Former Member
0 Kudos

You will get OVS1 only b'cause you are getting the value of selected value of dropdown and based on this value you are assigning to OVS controller.

Former Member
0 Kudos

Hi Tatayya,

I tried your method but it still assigns the same ovs for all the rows in the table.

Can you send me the example that tested this on?

Regards

Prakash

Former Member
0 Kudos

Hi,

You can probably have more than one OVS listeners implemented within the same controller class and similarly different context input and output nodes. Then based on the value selected from the dropdown you can set the OVS listener for the attribute bound to the inputfield in the second column. Something like this:


  //In the onchange event handler of the dropdown
  IWDAttributeInfo[] ovsStartUpAttributes = {wdContext.node<Name>().getNodeInfo().getAttribute("<attribute name>")}; //attribute bound to the input field

  switch(selectedValue){
    case 1:   IWDOVSContextNotificationListener listener = wdThis.wdGetOVSCustController().getOVSListener1(); 
              WDValueServices.addOVSExtension("First Selection",
              // fields bound to startup attributes will be ovs-enabled 
             ovsStartUpAttributes, 
             wdThis.wdGetOVSCustController().getOVSInputNode(),
             wdThis.wdGetOVSCustController().getOVSOutputNode(), 
             listener);
             break;

    case 2: IWDOVSContextNotificationListener listener = wdThis.wdGetOVSCustController().getOVSListener2(); //returns the second OVS listener
              //etc...
  }

Regards,

Satyajit.

Former Member
0 Kudos

hi,

Thanks for the reply. I will give it a try and let you know.

Regards

Prakash