Skip to content

Commit

Permalink
Configure which colums should not be sorted (#192)
Browse files Browse the repository at this point in the history
* Hide some columns when printing

* Fix typo on columns

* Do no sort first column

* Add dtorder property to attributes map

* Doc for dtorder property
  • Loading branch information
coudot authored Dec 2, 2024
1 parent 6defddd commit d85d4fe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
14 changes: 7 additions & 7 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@
'displayname' => array( 'attribute' => 'displayname', 'faclass' => 'user-circle', 'type' => 'text' ),
'employeenumber' => array( 'attribute' => 'employeenumber', 'faclass' => 'hashtag', 'type' => 'text' ),
'employeetype' => array( 'attribute' => 'employeetype', 'faclass' => 'id-badge', 'type' => 'text' ),
'fax' => array( 'attribute' => 'facsimiletelephonenumber', 'faclass' => 'fax', 'type' => 'tel' ),
'firstname' => array( 'attribute' => 'givenname', 'faclass' => 'user-o', 'type' => 'text' ),
'fax' => array( 'attribute' => 'facsimiletelephonenumber', 'faclass' => 'fax', 'type' => 'tel', 'dtorder' => 'disable' ),
'firstname' => array( 'attribute' => 'givenname', 'faclass' => 'user-o', 'type' => 'text' , 'dtorder' => 'disable' ),
'fullname' => array( 'attribute' => 'cn', 'faclass' => 'user-circle', 'type' => 'text' ),
'l' => array( 'attribute' => 'l', 'faclass' => 'globe', 'type' => 'text' ),
'lastname' => array( 'attribute' => 'sn', 'faclass' => 'user-o', 'type' => 'text' ),
'mail' => array( 'attribute' => 'mail', 'faclass' => 'envelope-o', 'type' => 'mailto' ),
'mailquota' => array( 'attribute' => 'gosamailquota', 'faclass' => 'pie-chart', 'type' => 'bytes' ),
'manager' => array( 'attribute' => 'manager', 'faclass' => 'user-circle-o', 'type' => 'dn_link' ),
'mobile' => array( 'attribute' => 'mobile', 'faclass' => 'mobile', 'type' => 'tel' ),
'mailquota' => array( 'attribute' => 'gosamailquota', 'faclass' => 'pie-chart', 'type' => 'bytes', 'dtorder' => 'disable' ),
'manager' => array( 'attribute' => 'manager', 'faclass' => 'user-circle-o', 'type' => 'dn_link', 'dtorder' => 'disable' ),
'mobile' => array( 'attribute' => 'mobile', 'faclass' => 'mobile', 'type' => 'tel', 'dtorder' => 'disable' ),
'modified' => array( 'attribute' => 'modifytimestamp', 'faclass' => 'clock-o', 'type' => 'date' ),
'organization' => array( 'attribute' => 'o', 'faclass' => 'building', 'type' => 'text' ),
'organizationalunit' => array( 'attribute' => 'ou', 'faclass' => 'building-o', 'type' => 'text' ),
'pager' => array( 'attribute' => 'pager', 'faclass' => 'mobile', 'type' => 'tel' ),
'phone' => array( 'attribute' => 'telephonenumber', 'faclass' => 'phone', 'type' => 'tel' ),
'pager' => array( 'attribute' => 'pager', 'faclass' => 'mobile', 'type' => 'tel' , 'dtorder' => 'disable' ),
'phone' => array( 'attribute' => 'telephonenumber', 'faclass' => 'phone', 'type' => 'tel', 'dtorder' => 'disable' ),
'postaladdress' => array( 'attribute' => 'postaladdress', 'faclass' => 'map-marker', 'type' => 'address' ),
'postalcode' => array( 'attribute' => 'postalcode', 'faclass' => 'globe', 'type' => 'text' ),
'secretary' => array( 'attribute' => 'secretary', 'faclass' => 'user-circle-o', 'type' => 'dn_link' ),
Expand Down
1 change: 1 addition & 0 deletions docs/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Attributes are defined in ``$attributes_map``, where each item is an array with
* ``faclass``: name of Font Awesome icon class
* ``type``: type of attribute (text, mailto, tel or date)
* ``sort``: optional, when attribute is multi-valued, sort them. Two possible values: ``ascending`` (default) or ``descending``
* ``dtorder``: optional, set value to ``disable`` to remove sorting on the column

This is used to configure how attribute is displayed.

Expand Down
4 changes: 2 additions & 2 deletions templates/footer.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
bottom2Start: {
buttons: [
{if $datatables_print_all}
{ extend: 'print', text: '{$msg_print_all}', autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{ extend: 'print', text: '{$msg_print_all}', exportOptions: { columns: ':not(.hidden-print)' }, autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{/if}
{if $datatables_print_page}
{ extend: 'print', text: '{$msg_print_page}', exportOptions: { modifier: { page: 'current' } }, autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{ extend: 'print', text: '{$msg_print_page}', exportOptions: { columns: ':not(.hidden-print)', modifier: { page: 'current' } }, autoPrint: {if $datatables_auto_print}true{else}false{/if} },
{/if}
]
}
Expand Down
4 changes: 2 additions & 2 deletions templates/listing_table.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!--table class="table table-striped table-hover table-condensed dataTable"-->
<thead>
<tr>
<th class="hidden-print nosort">&nbsp;</th>
{foreach $listing_columns as $item}<th>{$msg_label_{$item}}</th>{/foreach}
<th class="hidden-print" data-dt-order="disable">&nbsp;</th>
{foreach $listing_columns as $item}<th{if $attributes_map.{$item}.dtorder} data-dt-order="{$attributes_map.{$item}.dtorder}"{/if}>{$msg_label_{$item}}</th>{/foreach}
</tr>
</thead>
<tbody>
Expand Down

0 comments on commit d85d4fe

Please sign in to comment.