Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
cbe506aa
Commit
cbe506aa
authored
8 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
clicking on search fiekd doesn't change order by
parent
47ca62ef
No related branches found
No related tags found
1 merge request
!34
Performance of subject list
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/api_views.py
+18
-11
18 additions, 11 deletions
smash/web/api_views.py
smash/web/templates/subjects/index.html
+25
-11
25 additions, 11 deletions
smash/web/templates/subjects/index.html
with
43 additions
and
22 deletions
smash/web/api_views.py
+
18
−
11
View file @
cbe506aa
...
...
@@ -95,14 +95,14 @@ def get_subjects_filtered(subjects, filters):
result
=
result
.
filter
(
screening_number__contains
=
value
)
else
:
print
row
# elif order_column == "default_location":
# result = subjects.order_by(order_direction + 'default_location')
# elif order_column == "dead":
# result = subjects.order_by(order_direction + 'dead')
# elif order_column == "resigned":
# result = subjects.order_by(order_direction + 'resigned')
# elif order_column == "postponed":
# result = subjects.order_by(order_direction + 'postponed')
# elif order_column == "default_location":
# result = subjects.order_by(order_direction + 'default_location')
# elif order_column == "dead":
# result = subjects.order_by(order_direction + 'dead')
# elif order_column == "resigned":
# result = subjects.order_by(order_direction + 'resigned')
# elif order_column == "postponed":
# result = subjects.order_by(order_direction + 'postponed')
return
result
...
...
@@ -154,6 +154,13 @@ def subjects(request, type):
})
def
get_yes_no
(
val
):
if
val
:
return
"
YES
"
else
:
return
"
NO
"
def
serialize_subject
(
subject
):
location
=
""
if
subject
.
default_location
is
not
None
:
...
...
@@ -165,9 +172,9 @@ def serialize_subject(subject):
"
nd_number
"
:
subject
.
nd_number
,
"
screening_number
"
:
subject
.
screening_number
,
"
default_location
"
:
location
,
"
dead
"
:
subject
.
dead
,
"
resigned
"
:
subject
.
resigned
,
"
postponed
"
:
subject
.
postponed
,
"
dead
"
:
get_yes_no
(
subject
.
dead
)
,
"
resigned
"
:
get_yes_no
(
subject
.
resigned
)
,
"
postponed
"
:
get_yes_no
(
subject
.
postponed
)
,
}
return
result
...
...
This diff is collapsed.
Click to expand it.
smash/web/templates/subjects/index.html
+
25
−
11
View file @
cbe506aa
...
...
@@ -28,32 +28,41 @@
<div
class=
"box-body"
>
<table
id=
"table"
class=
"table table-bordered table-striped"
>
<thead>
<tr>
<th>
ND
</th>
<th>
Screening
</th>
<th>
First name
</th>
<th>
Last name
</th>
<th>
Default location
</th>
<th>
Deceased
</th>
<th>
Resigned
</th>
<th>
Postponed
</th>
<th>
Edit
</th>
</tr>
</thead>
<tfoot
style=
"display: table-header-group;"
>
<tr>
<th>
<div
name=
"string_filter"
>
ND
</div>
ND
</th>
<th>
<div
name=
"string_filter"
>
Screening number
</div>
Screening
</th>
<th>
<div
name=
"string_filter"
>
Name
</div>
First name
</th>
<th>
<div
name=
"string_filter"
>
Surname
</div>
Last name
</th>
<th>
Default location
</th>
<th>
Deceased
</th>
<th>
<div
name=
"yes_no_filter"
>
---
</div>
</th>
<th>
Resigned
</th>
<th>
Postponed
</th>
<th>
Edit
</th>
</tr>
</t
head
>
</t
foot
>
<tbody>
</tbody>
...
...
@@ -68,11 +77,16 @@
<script
src=
"{% static 'AdminLTE/plugins/datatables/dataTables.bootstrap.min.js' %}"
></script>
<script>
$
(
'
#table t
head
div[name="string_filter"]
'
).
each
(
function
()
{
$
(
'
#table t
foot
div[name="string_filter"]
'
).
each
(
function
()
{
var
title
=
$
(
this
).
text
();
$
(
this
).
html
(
'
<input type="text" placeholder="Search
'
+
title
+
'
" />
'
);
});
$
(
'
#table tfoot div[name="yes_no_filter"]
'
).
each
(
function
()
{
var
title
=
$
(
this
).
text
();
$
(
this
).
html
(
'
<select ><option value selected="selected">----------</option><option value="true">YES</option><option value="false">NO</option></select>
'
);
});
$
(
function
()
{
var
table
=
$
(
'
#table
'
).
DataTable
({
serverSide
:
true
,
...
...
@@ -93,7 +107,7 @@
table
.
columns
().
every
(
function
()
{
var
that
=
this
;
$
(
'
input
'
,
this
.
head
er
()).
on
(
'
keyup change
'
,
function
()
{
$
(
'
input
'
,
this
.
foot
er
()).
on
(
'
keyup change
'
,
function
()
{
if
(
that
.
search
()
!==
this
.
value
)
{
that
.
search
(
this
.
value
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment