Search code examples
richfacesjsf-1.2ajax4jsfrichdatatablerendered-attribute

update rich:datatable when rich:inputNumberSlider value change


my interface is like in the picture

enter image description here

I want the value of the réduction field changes when the value of the inputNumberSlider changes.

<rich:inputNumberSlider id="slider"
    rendered="#{bean.showReductionForm}"
    value="#{bean.reduction}" 
    showArrows="true" 
    width="220"/>
<a4j:support event="onchange" reRender="datatableId"
    ajaxSingle="true"
    actionListener="#{bean.appRed}" /> 

any help plz


Solution

  • You should put a4j:support as a child of rich:inputNumberSlider in order to make it work.

    Also for performance and usability reasons I would consider using ignoreDupResponses and requestDelay attributes (Documentation):

    <rich:inputNumberSlider id="slider"
        rendered="#{bean.showReductionForm}"
        value="#{bean.reduction}" 
        showArrows="true"
        width="220">
    
        <a4j:support event="onchange" reRender="datatableId"
            ajaxSingle="true"
            actionListener="#{bean.appRed}"
            ignoreDupResponses="true"
            requestDelay="300"/> 
    
    </rich:inputNumberSlider>