Skip to content

Commit

Permalink
#4051 add javascript functions for ToggleSelect and unselect row
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed Dec 14, 2017
1 parent dd88232 commit 2d6e2c3
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/main/webapp/filesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@
xmlns:o="http://omnifaces.org/ui"
xmlns:iqbs="http://xmlns.jcp.org/jsf/composite/iqbs">

<script>
var checked=false;

function checkFiles(updateRows){
checked = !checked;
if (updateRows){
if(checked){
PF('filesTable').selectAllRows();
} else {
PF('filesTable').unselectAllRows(); //
}
}
}

function setCheckedFalse(){ // method to guarantee that allselected(checked) set to false
checked = true;
checkFiles(false);
}

</script>

<!-- Files Table -->
<p:dataTable id="filesTable"
scrollRows="25" scrollable="true" liveScroll="true"
Expand All @@ -20,8 +41,8 @@
selection="#{DatasetPage.selectedFiles}" var="fileMetadata" widgetVar="filesTable"
rendered="#{empty DatasetPage.editMode and (DatasetPage.workingVersion != null)}"
emptyMessage="#{bundle['file.notFound.tip']}">
<p:ajax event="toggleSelect" listener="#{DatasetPage.toggleAllSelected()}" />
<p:ajax event="rowUnselectCheckbox" listener="#{DatasetPage.setSelectAllFiles(false)}" update="filesTable" process="@this" />
<p:ajax event="toggleSelect" oncomplete="checkFiles(true)" />
<p:ajax event="rowUnselectCheckbox" oncomplete="setCheckedFalse()" />
<f:facet name="header">
<div class="row form-inline" jsf:id="cloudStorageBlock" jsf:rendered="#{DatasetPage.showComputeButton()}">
<!-- Cloud Storage Access -->
Expand Down

0 comments on commit 2d6e2c3

Please sign in to comment.