My main problem is I want to remove/unbind rowSelect, rowUnselect and rowDblselect events
from datatable.
<p:dataTable id="myTable" value="#{myBean.myLazyModel}" var="var"
selection="#{myBean.selectedBean}" styleClass="uta-table lightgrey-table">
<p:column selectionMode="multiple" id="select"
style="width:2%;text-align:center" />
<p:column id="namecol" headerText="Name" style="text-align:center">
<p:inputText id="name" value="#{var.name}"
styleClass="uta-textbox" style="text-align:center">
</p:inputText>
</p:column>
</p:dataTable>
Assume the datatable has only 5 rows. Now I have selected first 4 rows by selecting checkbox (not by clicking on row). If I select 5th row by clicking on the row(not selecting the checkbox) then the previous 4 rows are deselected resulting in only 5th row being selected. This is something concerns my client.
To avoid this problem I thought of unbinding/removing rowSelect event means I should be able to select a row only by selecting checkbox. This same problem persists in the primeface showcase also.
http://www.primefaces.org/showcase/ui/datatableRowSelectionRadioCheckbox.jsf
I tried to unbind/remove rowSelect event in the following two ways using jQuery css selectors
<script type="text/javascript">
jQuery(function() {
$('.lightgrey-table').off("rowSelect");
$('.lightgrey-table').off("rowUnselect");
$('.lightgrey-table').off("rowDblselect");
});
</script>
second way
<script type="text/javascript">
jQuery(function() {
$('.lightgrey-table').unbind("rowSelect");
$('.lightgrey-table').unbind("rowUnselect");
$('.lightgrey-table').unbind("rowDblselect");
});
</script>
both didn't work for me. Could any one help me to resolve this.
thanks in advance guys
p:column selectionMode="multiple"
should inactivate row-click selection, enabling it only for checkbox. However, it seems not to be in their priorities code.google.com/p/primefaces/issues/detail?id=5206 – Xtreme Biker