Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
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
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
c1adcf83
Commit
c1adcf83
authored
10 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-1068: add sort on column header in standard tables
parent
6e05328c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/core/gui/components/table/TableRenderer.java
+23
-16
23 additions, 16 deletions
...ava/org/olat/core/gui/components/table/TableRenderer.java
with
23 additions
and
16 deletions
src/main/java/org/olat/core/gui/components/table/TableRenderer.java
+
23
−
16
View file @
c1adcf83
...
...
@@ -104,7 +104,7 @@ public class TableRenderer extends DefaultComponentRenderer {
String
formName
=
renderMultiselectForm
(
target
,
source
,
ubu
,
iframePostEnabled
);
target
.
append
(
"<div class=\"o_table_wrapper\" id=\"o_table_wrapper_"
).
append
(
table
.
hashCode
()).
append
(
"\">"
)
.
append
(
"<table id=\"o_table"
).
append
(
table
.
hashCode
()).
append
(
"\" class=\"o_table table table-striped table-condensed table-hover"
).
append
(
CLOSE_HTML_BRACE
);
appendHeaderLinks
(
target
,
translator
,
table
,
cols
);
appendHeaderLinks
(
target
,
translator
,
table
,
formName
,
cols
);
appendDataRows
(
renderer
,
target
,
ubu
,
table
,
iframePostEnabled
,
cols
,
selRowUnSelectable
,
selRowId
,
startRowId
,
endRowId
);
target
.
append
(
"</table><div class='o_table_footer'>"
);
appendSelectDeselectAllButtons
(
target
,
translator
,
table
,
formName
,
rows
,
resultsPerPage
);
...
...
@@ -257,7 +257,7 @@ public class TableRenderer extends DefaultComponentRenderer {
TableDataModel
<?>
model
=
table
.
getTableDataModel
();
if
(
model
instanceof
TableDataModelWithMarkableRows
)
{
TableDataModelWithMarkableRows
markableModel
=
(
TableDataModelWithMarkableRows
)
model
;
TableDataModelWithMarkableRows
<?>
markableModel
=
(
TableDataModelWithMarkableRows
<?>
)
model
;
String
rowCss
=
markableModel
.
getRowCssClass
(
currentPosInModel
);
if
(
rowCss
!=
null
)
{
cssClass
+=
" "
+
rowCss
;
...
...
@@ -343,24 +343,31 @@ public class TableRenderer extends DefaultComponentRenderer {
target
.
append
(
CLOSE_HREF
);
}
private
void
appendHeaderLinks
(
final
StringOutput
target
,
final
Translator
translator
,
Table
table
,
int
cols
)
{
if
(
table
.
isDisplayTableHeader
())
{
target
.
append
(
"<thead><tr>"
);
for
(
int
i
=
0
;
i
<
cols
;
i
++)
{
ColumnDescriptor
cd
=
table
.
getColumnDescriptor
(
i
);
String
header
;
if
(
cd
.
translateHeaderKey
())
{
header
=
translator
.
translate
(
cd
.
getHeaderKey
());
}
else
{
header
=
cd
.
getHeaderKey
();
}
private
void
appendHeaderLinks
(
final
StringOutput
target
,
final
Translator
translator
,
Table
table
,
String
formName
,
int
cols
)
{
if
(
!
table
.
isDisplayTableHeader
())
return
;
target
.
append
(
"<thead><tr>"
);
for
(
int
i
=
0
;
i
<
cols
;
i
++)
{
ColumnDescriptor
cd
=
table
.
getColumnDescriptor
(
i
);
String
header
;
if
(
cd
.
translateHeaderKey
())
{
header
=
translator
.
translate
(
cd
.
getHeaderKey
());
}
else
{
header
=
cd
.
getHeaderKey
();
}
target
.
append
(
"<th>"
)
target
.
append
(
"<th>"
);
// header either a link or not
if
(
table
.
isSortingEnabled
()
&&
cd
.
isSortingAllowed
())
{
target
.
append
(
"<a class='o_orderby' href=\"javascript:tableFormInjectCommandAndSubmit('"
)
.
append
(
formName
).
append
(
"','"
).
append
(
Table
.
COMMAND_SORTBYCOLUMN
).
append
(
"','"
).
append
(
i
).
append
(
"');\">"
)
.
append
(
header
)
.
append
(
"</th>"
);
.
append
(
CLOSE_HREF
);
}
else
{
target
.
append
(
header
);
}
target
.
append
(
"</t
r></thead
>"
);
target
.
append
(
"</t
h
>"
);
}
target
.
append
(
"</tr></thead>"
);
}
private
String
renderMultiselectForm
(
final
StringOutput
target
,
final
Component
source
,
final
URLBuilder
ubu
,
final
boolean
iframePostEnabled
)
{
...
...
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