Skip to content

Commit b84cb20

Browse files
committed
Update id column to be sortable
1 parent 1ddb1f9 commit b84cb20

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.p-sortable-column {
2+
background-color: #181818 !important;
3+
}
4+
5+
.p-sortable-column:not(.p-highlight):hover {
6+
background-color: #181818 !important;
7+
}

frontend/src/app/questions/questions.component.html

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
</div>
2626
</p-toolbar>
2727
<p-table
28+
sortField="id"
29+
[sortOrder]="1"
2830
[columns]="cols"
2931
[value]="questions"
3032
[(selection)]="selectedQuestions"
3133
datakey="id"
32-
[tableStyle]="{ 'min-width': '50rem' }"
34+
[tableStyle]="{ 'table-layout': 'fixed' }"
3335
[paginator]="true"
3436
[rows]="5"
3537
[rowsPerPageOptions]="[5, 10, 20]"
@@ -41,13 +43,13 @@ <h3 class="m-0">Manage Questions</h3>
4143
</ng-template>
4244
<ng-template pTemplate="header" let-columns>
4345
<tr>
44-
<th style="width: 4rem"><p-tableHeaderCheckbox /></th>
45-
<th>Id</th>
46-
<th>Title</th>
47-
<th>Description</th>
48-
<th>Topics</th>
49-
<th>Difficulty</th>
50-
<th></th>
46+
<th style="width: 10%"><p-tableHeaderCheckbox /></th>
47+
<th pSortableColumn="id" style="width: 10%">Id <p-sortIcon field="id" /></th>
48+
<th style="width: 10%">Title</th>
49+
<th style="width: 40%">Description</th>
50+
<th style="width: 10%">Topics</th>
51+
<th style="width: 10%">Difficulty</th>
52+
<th style="width: 10%"></th>
5153
</tr>
5254
</ng-template>
5355
<ng-template pTemplate="body" let-question>

0 commit comments

Comments
 (0)