File tree Expand file tree Collapse file tree 5 files changed +29
-3
lines changed
java/io/jenkins/plugins/datatables
test/java/io/jenkins/plugins/datatables Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,9 @@ public enum ColumnCss {
166166 */
167167 NUMBER ("text-right" ),
168168 /** Disables sorting of the column. Rendering is the same as with {@code NONE}. */
169- NO_SORT ("nosort" );
169+ NO_SORT ("nosort" ),
170+ /** Hides the column for view. It still exists and responds to searching */
171+ HIDDEN ("hidden" );
170172
171173 private final String cssClass ;
172174
Original file line number Diff line number Diff line change 3535 </j : if >
3636 <table class =" table table-hover table-striped data-table ${class}"
3737 data-columns-definition =" ${model.columnsDefinition}" id =" ${model.id}"
38- data-table-configuration =" ${model.tableConfigurationDefinition}" >
38+ data-table-configuration =" ${model.tableConfigurationDefinition}"
39+ style =" width: 100%;" >
3940 <colgroup >
4041 <j : forEach var =" c" items =" ${model.columns}" >
4142 <col class =" col-width-${c.width}" />
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ div.details-control {
5252/* ------------------------------------------------------------------------------------------------------------------- */
5353/* Custom column widths for property tables */
5454/* ------------------------------------------------------------------------------------------------------------------- */
55-
55+ .col-width-0 {
56+ width : 0% ;
57+ }
5658.col-width-1 {
5759 width : 8.333333% ;
5860}
Original file line number Diff line number Diff line change @@ -40,6 +40,12 @@ jQuery3(document).ready(function () {
4040 return data ;
4141 }
4242 }
43+ } ,
44+ {
45+ targets : 'hidden' , // All columns with the '.hidden' class in the <th>
46+ visible : false ,
47+ searchable : true ,
48+ orderable : false // There is no point in allowing sort by this column if it's not visible.
4349 }
4450 ] ,
4551 columns : JSON . parse ( table . attr ( 'data-columns-definition' ) )
Original file line number Diff line number Diff line change @@ -65,4 +65,19 @@ void shouldCreateDetailsColumnDiv() {
6565 + "</svg>"
6666 + "</div>" );
6767 }
68+
69+ @ Test
70+ void shouldCreateHiddenColumn () {
71+ TableColumn column = new TableColumn (LABEL , "Hidden" , "String" )
72+ .setHeaderClass (ColumnCss .HIDDEN )
73+ .setWidth (0 );
74+
75+ assertThat (column ).hasHeaderLabel (LABEL );
76+ assertThat (column ).hasDefinition ("{ \" type\" : \" String\" , "
77+ + "\" data\" : \" Hidden\" , "
78+ + "\" defaultContent\" : \" \" , "
79+ + "\" render\" : { \" _\" : \" display\" , \" sort\" : \" sort\" }}" );
80+ assertThat (column ).hasHeaderClass ("hidden" );
81+ assertThat (column ).hasWidth (0 );
82+ }
6883}
You can’t perform that action at this time.
0 commit comments