• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

table and partial triggers

 
sree javab
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can someone please help me with this;
I have a table where say I have 3 rows with the same columns in each row.
I want to enable/disable a text filed in a particular row depending on the value selected in the drop down of that row. When I try doing that, all my rows get refreshed and all the text fields in all rows get enabled, (as I update the table itself by puting partialTriggers attribute to table). But if no partialTrigger is specified to table, my table does not get refreshed.

What should be the change if I want the partialTrigger to be applicable to corresponding row of dropdown?

example :

<tr:table partialTriggers="typeOfAttribute" value="#{objectConfigBean.customConfigHolder}" var="row" rows="3">
<tr:column >
<f:facet name="header">
<trutputText value="#{objConfigBundle.type}"/>
</f:facet>


<tr:selectOneChoice id="typeOfAttribute" immediate="true" autoSubmit="true" valueChangeListener="#{objectConfigBean.typeChangeListener}" label="#{objConfigBundle.type}" unselectedLabel="#{objConfigBundle.unselectedType}" value="#{row.type}">
<f:selectItem itemValue="#{objectConfigBean.TEXT}" itemLabel="#{objConfigBundle.text}"/>
<f:selectItem itemValue="#{objectConfigBean.NUMERIC}" itemLabel="#{objConfigBundle.numeric}"/>
<f:selectItem itemValue="#{objectConfigBean.DATE}" itemLabel="#{objConfigBundle.date}"/>
<f:selectItem itemValue="#{objectConfigBean.CHECKBOX}" itemLabel="#{objConfigBundle.checkbox}"/>
<f:selectItem itemValue="#{objectConfigBean.LOV}" itemLabel="#{objConfigBundle.lov}"/>
</tr:selectOneChoice>
<tr:tr:inputText id="groupId" rendered="true" disabled="#{objectConfigBean.typeSelected != 'LOV'}" partialTriggers="typeOfAttribute" label="Group" value="#{objectConfigBean.typeSelected}" />
</tr:column>
</tr:table>
 
Pushpalatha Gowdra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sree javab ,

I have a similar problem. Are you able to refresh a single column of table using PPR?

Regards,
Pushpa
 
Bart Kummel
author
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sree,

The problem is that your objectConfigBean is the same for each row in the table. I.o.w. there's only one objectConfigBean, that is the same for the whole table. You should realize that everything inside the <tr:table> is repeated ("stamped") for each row in the table. So if you want to have the disabled state of your <tr:inputText> different for each row, you should somehow relate it to the row attribute, that is different for each row. I think what you want is something like this:

The only things I changed compared to your code are:
  • I left out the column headers for brevity
  • I changed the disabled property of the <tr:inputText> to #{row.type != 'LOV'}
  • I moved the <tr:inputText> to its own column


  • I hope this helps.

    Best regards,
    Bart
     
    Pushpalatha Gowdra
    Greenhorn
    Posts: 18
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Bart,

    I think the partial trigger happens because of the partialTrigger attribute present in tr:table, not because of the partialTrigger attribute present in tr:inputText.

    Can we achieve this without actually refreshing the complete table?

    Regards,
    Pushpa
     
    Bart Kummel
    author
    Ranch Hand
    Posts: 81
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Pushpa,

    I overlooked the partialTriggers in the <tr:table>. That one isn't needed.

    Best regards,
    Bart
     
    Pushpalatha Gowdra
    Greenhorn
    Posts: 18
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hello Bart,

    I have the code as below, and column is not getting refreshed. If I put the tr:poll tag inside a column then, it refreshes only the 1st column.
    Could you please help me.

    <tr:form id="table">
    <tr:subform id="subformPoll">
    <tr:poll id="poll" interval="2000" pollListener="#{report2.incrementVisits}" ></tr:poll>
    </tr:subform>

    <tr:table id="EquipmentReport" var="page" value="#{report2.dataModel}" rows="3" rowBandingInterval="1" emptyText="Sorry! no records found" horizontalGridVisible="true" verticalGridVisible="true" >

    <tr:column headerText="Webpage Name" styleClass="headerClass">
    <trutputText value="#{page.name}" styleClass="outputText"/>
    </tr:column>

    <tr:column headerText="URL" styleClass="headerClass">
    <trutputText value="#{page.url}" styleClass="outputText" />
    </tr:column>

    <tr:column id="result" headerText="Number of Visits" styleClass="headerClass" partialTriggers=":subformPoll:poll">
    <trutputText id="status" partialTriggers=":subformPoll:poll" value="#{page.numVisits}" styleClass="outputText" />
    </tr:column>

    </tr:table>

    </tr:form>

    Regards,
    Pushpa
     
    Bart Kummel
    author
    Ranch Hand
    Posts: 81
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Pushpa,

    I think the problem is your partialTriggers attribute. I think it should start with a double colon, like this: partialTriggers="::subformPoll:poll". Hopt this helps...

    Best regards,
    Bart
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic