Remove selected row in scrollabledatatable
vargjohn Jul 24, 2013 6:38 AMHi All,
Can anybody help me if there is any way to remove the selected row in scrollabledatatable. I have a requirement in which i have three rows added to the scrollabledatatable which is an ArrayList in Java. When i remove any selected row in the scrollabledatatable, first row gets removed from list rather than the selected row and the list gets updated with the selected row value meaning when i navigate between rows in the scrollabledatatable the list gets updated with selected row value and all the elements which i added in the list is lost. My application is developed in JBoss Seam and Richfaces.
Suppose i added three elements 'a','b','c' into the list
1. When i remove 'c' from list.
2. 'a' gets removed and after navigating between rows list gets updated with 'c','c','c' values
Please give a solution to this problem. I am putting some code for reference.
<rich:scrollableDataTable id="eChannelTable" columns="4" width="830px" height="160px" value="#{organisation.eChannels}" var="eChan" selectionMode="single"
<a4j:support event="onRowClick" status="ajaxProgressStatus" reRender="eChannelEditButton,eChannelRemoveButton">
<f:setPropertyActionListener value="#{eChan}" target="#{eChannel}" />
</a4j:support>
<rich:column width="200px" sortExpression="#{eChan.partyRoleContactPurpose.contactMechanismPurpose.name}">
<f:facet name="header"><h:outputText value="Channel"/></f:facet>
<h:outputText value ="#{eChan.partyRoleContactPurpose.contactMechanismPurpose.name}" />
</rich:column>
<rich:column width="250px" sortExpression="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.name}">
<f:facet name="header"><h:outputText value="Reference"/></f:facet>
<h:outputText value ="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.name}" />
</rich:column>
<rich:column width="150px" sortExpression="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.validFromDate}">
<f:facet name="header"><h:outputText value="From"/></f:facet>
<h:outputText value ="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.validFromDate}" />
</rich:column>
<rich:column width="150px" sortExpression="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.validToDate}">
<f:facet name="header"><h:outputText value="To"/></f:facet>
<h:outputText value ="#{eChan.partyRoleContactPurpose.partyRoleContactMechanism.validToDate}" />
</rich:column>
</rich:scrollableDataTable>
<h:panelGrid columns="3">
<a4j:commandButton id="eChannelAddButton"
styleClass="addButton"
value="Add"
action="#{eChannelHandler.init()}"
reRender="eChannelPopup"
status="ajaxProgressStatus"
ajaxSingle="true"
oncomplete="Richfaces.showModalPanel('eChannelPopup')"
disabled="#{disabled}" />
<a4j:commandButton id="eChannelEditButton"
styleClass="addButton"
value="Edit"
reRender="eChannelPopup"
status="ajaxProgressStatus"
ajaxSingle="true"
oncomplete="Richfaces.showModalPanel('eChannelPopup')"
disabled="#{disabled or empty eChannel.partyRoleContactPurpose.contactMechanismPurpose.code or organisation.eChannels.size() eq 0}" />
<a4j:commandButton id="eChannelRemoveButton"
styleClass="remove"
value="Remove"
ajaxSingle="true"
action="#{organisation.eChannels.remove(eChannel)}"
reRender="eChannelTable,eChannelEditButton,eChannelRemoveButton"
status="ajaxProgressStatus"
disabled="#{disabled or empty eChannel.partyRoleContactPurpose.contactMechanismPurpose.code or organisation.eChannels.size() eq 0}"/>
</h:panelGrid>
Thanks & Regards,
John Varghese