This commit is contained in:
Le Deng
2017-03-06 13:00:07 -05:00
parent 29a2be1480
commit 4efefa3b72
3 changed files with 22 additions and 10 deletions

View File

@@ -3,7 +3,7 @@
<table id="bookListTable" class="table bordered highlight">
<thead>
<tr>
<th><input type="checkbox"/></th>
<th><input type="checkbox" (change)="updateSelected($event.target.checked)" /></th>
<th>Title</th>
<th>Author</th>
<th>Category</th>
@@ -17,7 +17,7 @@
<tr *ngFor="let book of bookList">
<td>
<input hidden="hidden" name="id" />
<input type="checkbox" [checked]="checked" (change)="updateRemoveBookList($event.target.checked, book)" />
<input type="checkbox" [checked]="allChecked" (change)="updateRemoveBookList($event.target.checked, book)" />
</td>
<td><a (click)="onSelect(book)" style="cursor: pointer">{{book.title}}</a></td>
<td>{{book.author}}</td>

View File

@@ -15,7 +15,9 @@ import {MdDialog, MdDialogRef} from '@angular/material';
export class BookListComponent implements OnInit {
private selectedBook : Book;
private checked:boolean;
private bookList: Book[];
private allChecked:boolean;
private removeBookList: Book[]=new Array();
constructor(private removeBookService:RemoveBookService, private getBookListService: GetBookListService, private router: Router, public dialog: MdDialog) {
@@ -48,7 +50,7 @@ export class BookListComponent implements OnInit {
err => {
console.log(err);
}
);
}
});
@@ -63,6 +65,16 @@ export class BookListComponent implements OnInit {
console.log(this.removeBookList);
}
updateSelected(checked:boolean){
if(checked) {
this.allChecked=true;
this.removeBookList=this.bookList;
} else {
this.allChecked=false;
this.removeBookList=[];
}
}
removeSelectedBooks() {
let dialogRef = this.dialog.open(DialogResultExampleDialog);
dialogRef.afterClosed().subscribe(result => {
@@ -73,7 +85,7 @@ export class BookListComponent implements OnInit {
},
err => {
}
);
};
location.reload();

View File

@@ -19,8 +19,8 @@
<file leaf-file-name="BookResource.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/BookResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="124" column="5" lean-forward="true" selection-start-line="124" selection-start-column="5" selection-end-line="124" selection-end-column="5" />
<state relative-caret-position="420">
<caret line="59" column="9" lean-forward="true" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
<folding />
</state>
</provider>
@@ -841,12 +841,12 @@
<workItem from="1486538831944" duration="450000" />
<workItem from="1488378219247" duration="650000" />
<workItem from="1488461561430" duration="18419000" />
<workItem from="1488731165185" duration="7270000" />
<workItem from="1488731165185" duration="8339000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="69282000" />
<option name="totallyTimeSpent" value="70351000" />
</component>
<component name="ToolWindowManager">
<frame x="71" y="38" width="1663" height="961" extended-state="0" />
@@ -1257,8 +1257,8 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/main/java/com/bookstore/resource/BookResource.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="450">
<caret line="124" column="5" lean-forward="true" selection-start-line="124" selection-start-column="5" selection-end-line="124" selection-end-column="5" />
<state relative-caret-position="420">
<caret line="59" column="9" lean-forward="true" selection-start-line="59" selection-start-column="9" selection-end-line="59" selection-end-column="9" />
<folding />
</state>
</provider>