A
A
Alena2017-05-23 07:46:45
Java
Alena, 2017-05-23 07:46:45

Why are variables reset?

Hello, I have a problem:

<p:tab title="Настройка отчетов">
                            <h:form id="addCheckOk">

                                <p:outputLabel value="Наименование отчета" for="nameR" style="width: 100px"/><br/>
                                    <p:inputText id="nameR" value="#{reportDesigner.nameReport}" /><br/>

                                    <p:outputLabel for="paramTab" value="Выберите таблицу" style="font-weight: bold"/> <br/>
                                    <p:selectOneMenu id="paramTab"  value="#{reportDesigner.selectparamTable}" style="width:125px">

                                            <p:ajax listener="#{reportDesigner.searchColumnParam()}" update="columnReport1 columnReportFK1 qwe"/>
                                        <f:selectItem itemLabel="Выберите параметр" itemValue="" noSelectionOption="true" />
                                        <f:selectItems value="#{reportDesigner.paramTable}" />
                                    </p:selectOneMenu><br/>


                                    <p:outputLabel id="qwe" value="#{reportDesigner.selectColumn}" style="font-weight: bold"/><br/>

                                    <p:selectManyCheckbox id="columnReport1"  value="#{reportDesigner.selectColumn}"  layout="grid" columns="1" style="text-align: left">                                    
                                        <p:ajax update="qwe"/>
                                        <f:selectItems value="#{reportDesigner.columnTableR}"/>
                                    </p:selectManyCheckbox><br/>
                                    

                                    <p:outputLabel for="columnReportFK1" value="Выберите интересуемые столбцы внешних таблиц" style="font-weight: bold"/><br/>

                                    <p:selectManyCheckbox id="columnReportFK1"  value="#{reportDesigner.selectColumnFK}"  layout="grid" columns="1" style="text-align: left">                                    
                                        <f:selectItems value="#{reportDesigner.columnFK}"/>
                                    </p:selectManyCheckbox><br/>

                                    <p:outputLabel for="paramTable1" value="Выберите Функцию" style="font-weight: bold"/><br/>
                                    <p:selectOneMenu id="paramTable1"  value="#{reportDesigner.functionR}" style="width:125px">
                                        <p:ajax listener="#{reportDesigner.visulAddReport()}" update="ccx"/>
                                        <f:selectItem itemLabel="Выберите функцию" itemValue="" noSelectionOption="true" />
                                        <f:selectItem itemLabel="Среднее значение" itemValue="Среднее значение" />
                                        <f:selectItem itemLabel="Сумма" itemValue="Сумма" />
                                        <f:selectItem itemLabel="Количество" itemValue="Количество" />
                                        <f:selectItem itemLabel="Процент" itemValue="Процент" />
                                    </p:selectOneMenu><br/>
                                    
                                    <p:dataTable id="ccx" value="#{dataDB.tableCity}" 
                                         style="margin-bottom:280px; font-size: 12px" 
                                         rows="#{dataDB.tableCity.size()/dataDB.cnt}">
                                .........
                            </p:dataTable>
                            </h:form>
                        </p:tab>


After the first ajax, all variables are reset to zero and OneMenu and SelectCheckbox'y Tried to replace the buttons - the same thing. What is the problem how to solve, please help

PS selectColumn and selectColumnFK - declared as List

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alena, 2017-05-24
@SAlenaA

I decided this way: I added an annotation to the @ViewScoped bean and in the ajax elements I wrote in the first: event="change" process="@this" and in the second: event="change" process="@this columnReport1 columnReportFK1". If anyone could explain why this worked I would be very grateful.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question