Ajax <a4j:support> post contains every input field
nille Jun 22, 2009 4:00 AMHi,
I do have a problem with AJAX requests within dataTables. OIn the xhml site there are four datatables (the following one is the first)
<h:form id="eilberichtForm"> ... <rich:dataTable value="#{monatsberichtReportAction_Mitarbeiter.listWithNumberOfSubtables}" var="listHeaders" id="Monatsbericht_Mitarbeiter_MainTable"> ... <rich:subTable value="#{monatsberichtReportAction_Mitarbeiter.getMonatsberichtTable(0).descriptions}" var="mitarbeiterTableRow" id="monatsberichtValuesSubTable"> <rich:column styleClass="#{mitarbeiterTableRow.styleClass}"> <h:outputLink value="#{mitarbeiterTableRow.linkTarget}"> <h:outputText value="#{mitarbeiterTableRow.linkName}"/> </h:outputLink> </rich:column> <rich:column styleClass="#{mitarbeiterTableRow.styleClass}"> <h:outputText value="#{mitarbeiterTableRow.description}"/> </rich:column> <rich:columns value="#{monatsberichtReportAction_Mitarbeiter.getMonatsberichtTable(0).getArrayWithFieldValues(mitarbeiterTableRow.mappedToValuesRowId)}" var="field" index ="ind3" styleClass="#{field.getStyleClass()}" colspan="#{field.getColspan()}" visible="#{!field.isHidden()}"> <h:inputText value="#{field.fieldIntegerValue}"/> <a4j:support event="onchange" ajaxSingle="true" reRender="testOT1" action="#{monatsberichtReportAction_Mitarbeiter.calculateSums(0, mitarbeiterTableRow.mappedToValuesRowId, ind3)}"/> </h:inputText> </rich:columns> </rich:subTable>
Every input field <h:inputText> contains a <a4j:support> tag which is used to do some calculation in the backing bean. At at the bottom there is the 'test area'
<s:div id="testDiv"> <s:div id="testDivInner1"> <h:outputText id="testOT1" value="#{monatsberichtReportAction_Mitarbeiter.getMonatsberichtTable(0).getArrayWithFieldValues(0)[0].fieldIntegerValue}"/> </s:div> </s:div>
When I change a value in the input field the method in the backing bean is called and the correct field is re-rendered. The thing I don't understand now is: why are all input field within the form submitted? Firebug recorded the following POST:
AJAXREQUEST _viewRoot ajaxSingle eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id186:j_id187 eilberichtForm eilberichtForm eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id186:j_id187 -2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id186:j_id188 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id186:j_id188 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id190:j_id191 22 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id194:j_id195 33 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:0:j_id198:j_id199 44 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:1:j_id186:j_id187 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:1:j_id190:j_id191 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:1:j_id194:j_id195 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:1:j_id198:j_id199 5 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:2:j_id186:j_id187 7 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:2:j_id190:j_id191 8 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:3:j_id190:j_id191 9 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:3:j_id194:j_id195 10 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:4:j_id186:j_id187 14 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:4:j_id190:j_id191 15 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:5:j_id186:j_id187 16 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable:monatsberichtValuesSubTable:5:j_id190:j_id191 17 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:0:j_id301 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:0:j_id304 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:0:j_id307 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:0:j_id310 5 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:1:j_id301 1 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:1:j_id304 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:1:j_id307 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:1:j_id310 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:2:j_id301 21 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:2:j_id304 22 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:2:j_id307 23 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:2:j_id310 24 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:3:j_id301 1 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:3:j_id304 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:3:j_id307 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:3:j_id310 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:4:j_id301 6 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_2:monatsberichtValuesSubTable_2:4:j_id304 7 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:0:j_id410 32 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:0:j_id413 33 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:0:j_id416 34 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:0:j_id419 35 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:1:j_id410 113 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:1:j_id413 114 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:1:j_id416 115 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:1:j_id419 116 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:3:j_id410 34 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:3:j_id413 35 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:3:j_id416 36 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:3:j_id419 37 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:4:j_id410 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:4:j_id413 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:4:j_id416 5 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_3:monatsberichtValuesSubTable_3:4:j_id419 6 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:0:j_id519 1 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:0:j_id522 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:0:j_id525 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:0:j_id528 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:1:j_id519 5 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:1:j_id522 6 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:1:j_id525 7 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:1:j_id528 8 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:2:j_id519 9 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:2:j_id522 10 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:2:j_id525 11 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:2:j_id528 12 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:3:j_id519 13 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:3:j_id522 14 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:3:j_id525 15 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:3:j_id528 16 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:4:j_id519 1 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:4:j_id522 2 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:4:j_id525 3 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:4:j_id528 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:5:j_id519 5 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:5:j_id531 7 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:6:j_id519 4 eilberichtForm:Monatsbericht_Mitarbeiter_MainTable_4:monatsberichtValuesSubTable_4:6:j_id531 0
That's quite a lot and is slowing down the complete request/response. If that's the correct behavior someone may have an advice for me?
Thanks a lot in advance,
nille