0

I try to get the rowindex from the actual selected Column to unselect it with:

 public void rowSelect(SelectEvent event) {
        MyDataView selected = (MyDataView) event.getObject();
        if (!selectedData.remove(selected)) {
            selectedData.add(selected);
        } else {      
            RequestContext.getCurrentInstance().execute("PF('datatTable').unselectRow(rowindex);");
        }
    }
}

I know it is easy to unselect a row with the UnselectEvent and press "crtl" but my Customers want to unselect a row with one click.

    <p:dataTable widgetVar="datatTable" id="idDataTable" value="#{bean.dataview}" var="data" scrollable="true" scrollHeight="150"
                             rowSelectMode="add" selectionMode="multiple"
                selection="#{sendGroupSmsSimple.selectedReceivers}" rowKey="#{bean.id}" filteredValue="#{data.filterData}" rowIndexVar="dataRowIndex">
        <p:column id="recColumn" headerText="Name" filterBy="#{bean.fullname}" filterFunction="#{data.filterData}">
                <h:outputText value="#{bean.fullname}"/>
        </p:column>
        <p:ajax event="rowSelect" listener="#{sendGroupSmsSimple.rowSelect}" process="@this" update="mainForm:updatePanel"/>
</p:dataTable>

I don't want to update my whole Form because I want the actual state of my scrollbar. My actual Primefaces Version is 6.0. Scope of my Bean is GroupedConversationScoped. Thanks

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
xandl1994
  • 41
  • 2
  • 2
  • 12
  • Check this answer http://stackoverflow.com/questions/40836203/getting-id-of-item-in-listobject-in-jsf/40836517#40836517 – Albin Dec 15 '16 at 08:33
  • Why not determine that client-side in the oncomplete of the ajax call? – Kukeltje Dec 15 '16 at 08:51

0 Answers0