jsf - Disable selection in datatable -
i'm using primefaces 5.3, , i'm filling datatable records database if length of records lower 10 complete empty records datatable diplays 10 rows.
my datatable looks :
<p:datatable id="datatable" editable="true" editmode="cell" value="#{beanplanningl.getlistplanningsalle(entry, 1)}" var="planning" selectionmode="single" selection="#{beanplanning.selectedplanning}" rowkey="#{planning.id}" sortby="#{planning.heuredebut}" >
so want disable selection on rows has empty records.
how can ?
ps : planning.id
equals 0 in empty records.
edit :
i forgot mention used rendered
following :
<p:column > <p:celleditor rendered="#{planning.id != 0}"> <f:facet name="output"> <h:outputtext value="#{planning.heuredebut}" /></f:facet> <f:facet name="input"> <p:inputmask mask="99:99" value="#{planning.heuredebut}" required="true" maxlength="4" requiredmessage="heure de début : vous devez indiquer une valeur." validatormessage="heure de début non valide."> <f:validateregex pattern="([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]"/> </p:inputmask> </f:facet> </p:celleditor> </p:column>
but prevents editing cells, can selected.
edit 2 :
i tried use disabledselection
can't select rows cells can selected, before used disabledselection
:
as can see can select rows , on hovering colored.
and when used disabledselection
:
now hovering doesnt work empty rows , selection on rows well, cells can selected, no need prevent hapenning.
i noticed when cell selected 2 css classes added : ui-state-highlight ui-cell-editing
.
the solution did prevent default behaviour of columns doesnt have .ui-cell-editor
in it's childs following :
$(".ui-editable-column").click(function(event){ if(!$(this).find('.ui-cell-editor').length){ event.preventdefault(); return false; } });
Comments
Post a Comment