static setSelectionList

View: New views
2 Messages — Rating Filter:   Alert me  

static setSelectionList

by Will Heger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a cocoon form with many selection lists populated by flow.

Until now I had believed that my 'setSelectionList()' method calls alone were changing the list contents.  I did not realize the contents were dynamic by default.

My problem is performance.  I have many lists to update and I need fine-grained control over the list refreshes.

I can't find a way to specify a static list (or the StaticSelectionList) anywhere.

Thank in advance,
-Will


RE: static setSelectionList

by Robby Pelssers-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

See explanation in attached message.

 

Kind regards,

Robby

 

From: Will Heger [mailto:will.heger@...]
Sent: Wednesday, September 30, 2009 5:06 AM
To: users@...
Subject: static setSelectionList

 

I have a cocoon form with many selection lists populated by flow.

Until now I had believed that my 'setSelectionList()' method calls alone were changing the list contents.  I did not realize the contents were dynamic by default.

My problem is performance.  I have many lists to update and I need fine-grained control over the list refreshes.

I can't find a way to specify a static list (or the StaticSelectionList) anywhere.

Thank in advance,
-Will


RE: Selecting items on selection-list from flow.

While we're at it...

Here is some code that shows how you can set a selectionlist dynamically
from flowscript:

---------------------------------------------------------------------
importClass(Packages.org.apache.cocoon.forms.datatype.StaticSelectionLis
t);



cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
var form = new Form("your form definition pipeline");
var formWidget = form.form;

var projectNoteWidget = formWidget.lookupWidget("projectNote");


var possibleValues = cocoon.getComponent("someComponent").getXXX();

//!!! You have to pass the datatype of the actual Widget on which you
want to set the selectionlist and this widget has to implement the
DataWidget interface
var projectNoteValueList = new
StaticSelectionList(projectNoteWidget.getDatatype());  
for (var i=0; i < possibleValues.size(); i++) {
    projectNoteValueList.addItem(possibleValues.get(i));
}
//set the selectionlist on the projectnotewidget
projectNoteWidget.setSelectionList(projectNoteValueList);

//set default value on widget
projectNoteWidget.setValue(3);

---------------------------------------------------------------------

Kind regards,
Robby Pelssers

-----Original Message-----
From: Robby Pelssers [robby.pelssers@...]
Sent: Saturday, September 19, 2009 1:49 PM
To: users@...
Subject: RE: Selecting items on selection-list from flow.

Under the assumption that this field is a direct childwidget of the
form... you do it as follows:

       
cocoon.load("servlet:forms:/resource/internal/flow/javascript/Form.js");
        var form = new Form("your form definition pipeline");
      var formWidget = form.form;

      var projectNoteWidget = formWidget.lookupWidget("projectNote");
      projectNoteWidget.setValue(3);

Cheers,
Robby Pelssers


-----Original Message-----
From: Tomasz Piechowicz [tomasz.piechowicz@...]
Sent: Saturday, September 19, 2009 8:56 AM
To: users@...
Subject: Selecting items on selection-list from flow.

I have simple selection list in my from definition :

<fd:field id="projectNote">
        <fd:label>Ocena projektu: </fd:label>
        <fd:datatype base="double"/>
        <fd:selection-list>
                <fd:item value="2"/>
                <fd:item value="3"/>
                <fd:item value="3.5"/> 
                <fd:item value="4.0"/>
                <fd:item value="4.5"/>
                <fd:item value="5.0"/>
        </fd:selection-list>
</fd:field>

Can anyone tell me how to select an item on list from flow before
showing form to user ?

Regards,
Tomek Piechowicz

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...