Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
9647c913
Commit
9647c913
authored
Mar 19, 2020
by
kevalbhatt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3668 : UI: Sorting not working as expected for all the table
parent
97ecfc7e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
92 additions
and
32 deletions
+92
-32
BaseCollection.js
dashboardv2/public/js/collection/BaseCollection.js
+3
-2
Overrides.js
dashboardv2/public/js/utils/Overrides.js
+4
-1
TableLayout.js
dashboardv2/public/js/utils/TableLayout.js
+35
-10
SearchResultLayoutView.js
dashboardv2/public/js/views/search/SearchResultLayoutView.js
+3
-2
TagDetailTableLayoutView.js
dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
+1
-1
BaseCollection.js
dashboardv3/public/js/collection/BaseCollection.js
+3
-2
Overrides.js
dashboardv3/public/js/utils/Overrides.js
+4
-1
TableLayout.js
dashboardv3/public/js/utils/TableLayout.js
+35
-10
SearchResultLayoutView.js
dashboardv3/public/js/views/search/SearchResultLayoutView.js
+3
-2
TagDetailTableLayoutView.js
dashboardv3/public/js/views/tag/TagDetailTableLayoutView.js
+1
-1
No files found.
dashboardv2/public/js/collection/BaseCollection.js
View file @
9647c913
...
...
@@ -113,7 +113,7 @@ define(['require',
/** BaseCollection's Static Attributes */
{
// Static functions
getTableCols
:
function
(
cols
,
collection
)
{
getTableCols
:
function
(
cols
,
collection
,
defaultSortDirection
)
{
var
retCols
=
_
.
map
(
cols
,
function
(
v
,
k
,
l
)
{
var
defaults
=
collection
.
constructor
.
tableCols
[
k
];
if
(
!
defaults
)
{
...
...
@@ -121,7 +121,8 @@ define(['require',
defaults
=
{};
}
return
_
.
extend
({
'name'
:
k
'name'
:
k
,
direction
:
defaultSortDirection
?
defaultSortDirection
:
null
,
},
defaults
,
v
);
});
return
retCols
;
...
...
dashboardv2/public/js/utils/Overrides.js
View file @
9647c913
...
...
@@ -55,7 +55,10 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return
this
.
charAt
(
0
).
toUpperCase
()
+
this
.
slice
(
1
);
}
/*
* Overriding default sortType
*/
Backgrid
.
Column
.
prototype
.
defaults
.
sortType
=
"toggle"
;
/*
* Overriding Cell for adding custom className to Cell i.e <td>
...
...
dashboardv2/public/js/utils/TableLayout.js
View file @
9647c913
...
...
@@ -149,6 +149,20 @@ define(['require',
includeAtlasTableSorting
:
false
,
showDefaultTableSorted
:
false
,
/**
* [updateFullCollectionManually If collection was updated using silent true
* then need to update FullCollection Manually for correct sorting experience]
* @type {Boolean}
*/
updateFullCollectionManually
:
false
,
sortOpts
:
{
sortColumn
:
"name"
,
sortDirection
:
"ascending"
},
/** ui events hash */
events
:
function
()
{
...
...
@@ -183,26 +197,29 @@ define(['require',
initialize
:
function
(
options
)
{
this
.
limit
=
25
;
this
.
offset
=
0
;
_
.
extend
(
this
,
_
.
omit
(
options
,
'gridOpts'
,
'atlasPaginationOpts'
));
_
.
extend
(
this
,
_
.
omit
(
options
,
'gridOpts'
,
'
sortOpts'
,
'
atlasPaginationOpts'
));
_
.
extend
(
this
,
options
.
atlasPaginationOpts
);
_
.
extend
(
this
.
gridOpts
,
options
.
gridOpts
,
{
collection
:
this
.
collection
,
columns
:
this
.
columns
});
_
.
extend
(
this
.
sortOpts
,
options
.
sortOpts
);
if
(
this
.
includeAtlasTableSorting
)
{
var
oldSortingRef
=
this
.
collection
.
setSorting
;
this
.
collection
.
setSorting
=
function
()
{
this
.
state
.
pageSize
=
this
.
length
var
val
=
oldSortingRef
.
apply
(
this
,
arguments
);
val
.
fullCollection
.
models
.
sort
();
val
.
fullCollection
.
sort
();
this
.
comparator
=
function
(
next
,
previous
,
data
)
{
var
getValue
=
function
(
options
)
{
var
next
=
options
.
next
,
previous
=
options
.
previous
,
order
=
options
.
order
;
if
(
order
===
-
1
)
{
return
next
<
previous
?
-
1
:
1
;
if
(
next
===
previous
)
{
return
null
;
}
else
{
return
next
<
previous
?
1
:
-
1
;
if
(
order
===
-
1
)
{
return
next
<
previous
?
-
1
:
1
;
}
else
{
return
next
<
previous
?
1
:
-
1
;
}
}
}
if
(
val
.
state
&&
(
!
_
.
isNull
(
val
.
state
.
sortKey
)))
{
...
...
@@ -263,11 +280,14 @@ define(['require',
removeCellDirection function - removes "ascending" and "descending"
which in turn removes chevrons from every 'sortable' header-cells*/
this
.
listenTo
(
this
.
collection
,
"backgrid:sorted"
,
function
(
column
,
direction
,
collection
)
{
// backgrid:sorted fullCollection trigger required for icon chage
this
.
collection
.
fullCollection
.
trigger
(
"backgrid:sorted"
,
column
,
direction
,
collection
)
if
(
this
.
includeAtlasTableSorting
&&
this
.
updateFullCollectionManually
)
{
this
.
collection
.
fullCollection
.
reset
(
collection
.
toJSON
(),
{
silent
:
true
});
}
},
this
);
this
.
listenTo
(
this
,
"grid:refresh"
,
function
()
{
if
(
this
.
grid
)
{
this
.
grid
.
collection
.
fullCollection
.
reset
(
this
.
collection
.
entities
,
{
silent
:
true
});
this
.
grid
.
trigger
(
"backgrid:refresh"
);
}
});
...
...
@@ -337,8 +357,13 @@ define(['require',
this
.
grid
=
new
Backgrid
.
Grid
(
this
.
gridOpts
).
on
(
'backgrid:rendered'
,
function
()
{
that
.
trigger
(
'backgrid:manual:rendered'
,
this
)
});
this
.
rTableList
.
show
(
this
.
grid
);
if
(
this
.
showDefaultTableSorted
)
{
this
.
grid
.
render
();
this
.
grid
.
sort
(
this
.
sortOpts
.
sortColumn
,
this
.
sortOpts
.
sortDirection
);
this
.
rTableList
.
show
(
this
.
grid
);
}
else
{
this
.
rTableList
.
show
(
this
.
grid
);
}
},
onShow
:
function
()
{
if
(
this
.
includeSizeAbleColumns
)
{
...
...
dashboardv2/public/js/views/search/SearchResultLayoutView.js
View file @
9647c913
...
...
@@ -255,6 +255,8 @@ define(['require',
includeSizeAbleColumns
:
false
,
includeTableLoader
:
false
,
includeAtlasTableSorting
:
true
,
showDefaultTableSorted
:
true
,
updateFullCollectionManually
:
true
,
columnOpts
:
{
opts
:
{
initialColumnsVisible
:
null
,
...
...
@@ -436,9 +438,8 @@ define(['require',
attributeObject
:
dataOrCollection
.
entities
,
referredEntities
:
dataOrCollection
.
referredEntities
});
that
.
searchCollection
.
referredEntities
=
dataOrCollection
.
referredEntities
;
that
.
searchCollection
.
entities
=
dataOrCollection
.
entities
;
that
.
searchCollection
.
reset
(
dataOrCollection
.
entities
,
{
silent
:
true
});
that
.
searchCollection
.
fullCollection
.
reset
(
dataOrCollection
.
entities
,
{
silent
:
true
});
}
...
...
dashboardv2/public/js/views/tag/TagDetailTableLayoutView.js
View file @
9647c913
...
...
@@ -116,7 +116,7 @@ define(['require',
col
=
{};
return
this
.
tagCollection
.
constructor
.
getTableCols
({
t
ag
:
{
t
ypeName
:
{
label
:
"Classification"
,
cell
:
"html"
,
editable
:
false
,
...
...
dashboardv3/public/js/collection/BaseCollection.js
View file @
9647c913
...
...
@@ -113,7 +113,7 @@ define(['require',
/** BaseCollection's Static Attributes */
{
// Static functions
getTableCols
:
function
(
cols
,
collection
)
{
getTableCols
:
function
(
cols
,
collection
,
defaultSortDirection
)
{
var
retCols
=
_
.
map
(
cols
,
function
(
v
,
k
,
l
)
{
var
defaults
=
collection
.
constructor
.
tableCols
[
k
];
if
(
!
defaults
)
{
...
...
@@ -121,7 +121,8 @@ define(['require',
defaults
=
{};
}
return
_
.
extend
({
'name'
:
k
'name'
:
k
,
direction
:
defaultSortDirection
?
defaultSortDirection
:
null
,
},
defaults
,
v
);
});
return
retCols
;
...
...
dashboardv3/public/js/utils/Overrides.js
View file @
9647c913
...
...
@@ -55,7 +55,10 @@ define(['require', 'utils/Utils', 'marionette', 'backgrid', 'asBreadcrumbs', 'jq
return
this
.
charAt
(
0
).
toUpperCase
()
+
this
.
slice
(
1
);
}
/*
* Overriding default sortType
*/
Backgrid
.
Column
.
prototype
.
defaults
.
sortType
=
"toggle"
;
/*
* Overriding Cell for adding custom className to Cell i.e <td>
...
...
dashboardv3/public/js/utils/TableLayout.js
View file @
9647c913
...
...
@@ -149,6 +149,20 @@ define(['require',
includeAtlasTableSorting
:
false
,
showDefaultTableSorted
:
false
,
/**
* [updateFullCollectionManually If collection was updated using silent true
* then need to update FullCollection Manually for correct sorting experience]
* @type {Boolean}
*/
updateFullCollectionManually
:
false
,
sortOpts
:
{
sortColumn
:
"name"
,
sortDirection
:
"ascending"
},
/** ui events hash */
events
:
function
()
{
...
...
@@ -183,26 +197,29 @@ define(['require',
initialize
:
function
(
options
)
{
this
.
limit
=
25
;
this
.
offset
=
0
;
_
.
extend
(
this
,
_
.
omit
(
options
,
'gridOpts'
,
'atlasPaginationOpts'
));
_
.
extend
(
this
,
_
.
omit
(
options
,
'gridOpts'
,
'
sortOpts'
,
'
atlasPaginationOpts'
));
_
.
extend
(
this
,
options
.
atlasPaginationOpts
);
_
.
extend
(
this
.
gridOpts
,
options
.
gridOpts
,
{
collection
:
this
.
collection
,
columns
:
this
.
columns
});
_
.
extend
(
this
.
sortOpts
,
options
.
sortOpts
);
if
(
this
.
includeAtlasTableSorting
)
{
var
oldSortingRef
=
this
.
collection
.
setSorting
;
this
.
collection
.
setSorting
=
function
()
{
this
.
state
.
pageSize
=
this
.
length
var
val
=
oldSortingRef
.
apply
(
this
,
arguments
);
val
.
fullCollection
.
models
.
sort
();
val
.
fullCollection
.
sort
();
this
.
comparator
=
function
(
next
,
previous
,
data
)
{
var
getValue
=
function
(
options
)
{
var
next
=
options
.
next
,
previous
=
options
.
previous
,
order
=
options
.
order
;
if
(
order
===
-
1
)
{
return
next
<
previous
?
-
1
:
1
;
if
(
next
===
previous
)
{
return
null
;
}
else
{
return
next
<
previous
?
1
:
-
1
;
if
(
order
===
-
1
)
{
return
next
<
previous
?
-
1
:
1
;
}
else
{
return
next
<
previous
?
1
:
-
1
;
}
}
}
if
(
val
.
state
&&
(
!
_
.
isNull
(
val
.
state
.
sortKey
)))
{
...
...
@@ -263,11 +280,14 @@ define(['require',
removeCellDirection function - removes "ascending" and "descending"
which in turn removes chevrons from every 'sortable' header-cells*/
this
.
listenTo
(
this
.
collection
,
"backgrid:sorted"
,
function
(
column
,
direction
,
collection
)
{
// backgrid:sorted fullCollection trigger required for icon chage
this
.
collection
.
fullCollection
.
trigger
(
"backgrid:sorted"
,
column
,
direction
,
collection
)
if
(
this
.
includeAtlasTableSorting
&&
this
.
updateFullCollectionManually
)
{
this
.
collection
.
fullCollection
.
reset
(
collection
.
toJSON
(),
{
silent
:
true
});
}
},
this
);
this
.
listenTo
(
this
,
"grid:refresh"
,
function
()
{
if
(
this
.
grid
)
{
this
.
grid
.
collection
.
fullCollection
.
reset
(
this
.
collection
.
entities
,
{
silent
:
true
});
this
.
grid
.
trigger
(
"backgrid:refresh"
);
}
});
...
...
@@ -337,8 +357,13 @@ define(['require',
this
.
grid
=
new
Backgrid
.
Grid
(
this
.
gridOpts
).
on
(
'backgrid:rendered'
,
function
()
{
that
.
trigger
(
'backgrid:manual:rendered'
,
this
)
});
this
.
rTableList
.
show
(
this
.
grid
);
if
(
this
.
showDefaultTableSorted
)
{
this
.
grid
.
render
();
this
.
grid
.
sort
(
this
.
sortOpts
.
sortColumn
,
this
.
sortOpts
.
sortDirection
);
this
.
rTableList
.
show
(
this
.
grid
);
}
else
{
this
.
rTableList
.
show
(
this
.
grid
);
}
},
onShow
:
function
()
{
if
(
this
.
includeSizeAbleColumns
)
{
...
...
dashboardv3/public/js/views/search/SearchResultLayoutView.js
View file @
9647c913
...
...
@@ -264,6 +264,8 @@ define(['require',
includeSizeAbleColumns
:
false
,
includeTableLoader
:
false
,
includeAtlasTableSorting
:
true
,
showDefaultTableSorted
:
true
,
updateFullCollectionManually
:
true
,
columnOpts
:
{
opts
:
{
initialColumnsVisible
:
null
,
...
...
@@ -445,9 +447,8 @@ define(['require',
attributeObject
:
dataOrCollection
.
entities
,
referredEntities
:
dataOrCollection
.
referredEntities
});
that
.
searchCollection
.
referredEntities
=
dataOrCollection
.
referredEntities
;
that
.
searchCollection
.
entities
=
dataOrCollection
.
entities
;
that
.
searchCollection
.
reset
(
dataOrCollection
.
entities
,
{
silent
:
true
});
that
.
searchCollection
.
fullCollection
.
reset
(
dataOrCollection
.
entities
,
{
silent
:
true
});
}
...
...
dashboardv3/public/js/views/tag/TagDetailTableLayoutView.js
View file @
9647c913
...
...
@@ -116,7 +116,7 @@ define(['require',
col
=
{};
return
this
.
tagCollection
.
constructor
.
getTableCols
({
t
ag
:
{
t
ypeName
:
{
label
:
"Classification"
,
cell
:
"html"
,
editable
:
false
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment