Spinner with dynamic max value

UI Components for JSF
Post Reply
Deus
Posts: 6
Joined: 27 Jan 2011, 20:52

08 Feb 2011, 20:31

I am trying to create a spinner with a dynamic max value. Each time the spinner's value changes, I calculate a new maximum value for it.

Code: Select all

<p:spinner value="#{filesList.transitionTime}" min="1" max="#{filesList.maxValue}" id="timeline_transition_time" valueChangeListener="#{filesList.transitionTimeChangeListener}">
                        <f:ajax execute="timeline_transition_time" render="timeline_total_duration"/>
                    </p:spinner>

<h:panelGroup id="timeline_total_duration" layout="block">
...
</h:panelGroup>
Although in my backing bean FilesList I am able to set a maximum value correctly in the transitionTimeChangeListener, I can't update it in the view using Ajax (I know I could use onchange="submit()" but I don't want to submit the form everytime I change the spinner's value).

Any idea on how I could solve this problem?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Feb 2011, 00:23

max property is read only once when component is initialized, so server side changes are not reflected since you dont update client side. Updating spinner itself will probably help.

Deus
Posts: 6
Joined: 27 Jan 2011, 20:52

09 Feb 2011, 18:47

I had already tried to update spinner itself by inserting its id in the list of values of the f:ajax render attribute, like this:

Code: Select all

<p:spinner value="#{filesList.transitionTime}" min="1" max="#{filesList.maxValue}" id="timeline_transition_time" valueChangeListener="#{filesList.transitionTimeChangeListener}">
                        <f:ajax execute="timeline_transition_time" render="timeline_total_duration timeline_transition_time"/>
                    </p:spinner>
But everytime I change the spinner's value, it shows an "undefined" string:

Image

Was this your solution or did I misurderstand?

Deus
Posts: 6
Joined: 27 Jan 2011, 20:52

14 Feb 2011, 05:16

Any idea?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Google [Bot] and 21 guests