Skip to content

Commit

Permalink
Merge pull request #84 from RadheTians/table-view
Browse files Browse the repository at this point in the history
Added row clickable in customer table
  • Loading branch information
giorgiozoppi committed Jan 13, 2021
2 parents 942b317 + 37c6825 commit 890bcec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
3 changes: 1 addition & 2 deletions src/app/main/customer/customer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<nb-search type="modal-move"></nb-search>
<br>

<ng2-smart-table [settings]="settings" [source]="source" (userRowSelect)="onCustomerRowSelect($event)"
(custom)="onCustomAction($event)">
<ng2-smart-table [settings]="settings" [source]="source" (userRowSelect)="onCustomerRowSelect($event)">
</ng2-smart-table>

<div class="row pager-buttons" *ngIf="!loading">
Expand Down
13 changes: 11 additions & 2 deletions src/app/main/customer/customer.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
margin: 0 1rem;
}
}
:host /deep/ ng2-smart-table table > tbody > tr > td:hover {
cursor: pointer;
}

:host /deep/ ng2-smart-table table > tbody > tr > td {
font-size: 0.8rem;
Expand All @@ -47,14 +50,20 @@
height: 0 !important;
}

:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom {
:host
/deep/
ng2-st-tbody-custom
a.ng2-smart-action.ng2-smart-action-custom-custom {
display: inline-block;
height: auto;
width: 90px;
text-align: center;
font-size: 0.8rem !important;
}

:host /deep/ ng2-st-tbody-custom a.ng2-smart-action.ng2-smart-action-custom-custom:hover {
:host
/deep/
ng2-st-tbody-custom
a.ng2-smart-action.ng2-smart-action-custom-custom:hover {
color: #5dcfe3;
}
22 changes: 7 additions & 15 deletions src/app/main/customer/customer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,7 @@ export class CustomerComponent implements OnInit {

/** Settings for smart-table */
settings = {
selectMode: 'multi',
mode: 'external',
actions: {
custom: [
{
name: 'View',
title: 'View',
},
],
add: false,
edit: false,
delete: false,
},
actions: false,
columns: {
identifier: {
title: 'ID',
Expand Down Expand Up @@ -103,7 +91,10 @@ export class CustomerComponent implements OnInit {
renderComponent: CustomDateRenderComponent,
},
},
pager: false,
mode: 'external',
pager: {
display: false,
},
};

constructor(
Expand Down Expand Up @@ -222,7 +213,8 @@ export class CustomerComponent implements OnInit {

/** Customer row select event */
onCustomerRowSelect(event: any): void {
// const data = event.data;
const customer = event.data;
this.router.navigate(['detail', customer.identifier], { relativeTo: this.route });
}

onCustomAction(event: any): void {
Expand Down

0 comments on commit 890bcec

Please sign in to comment.