Components - Table module

Basic Table

Simple table. You just need to add the class table-basic to your table. If you want to make the header of the table sticky, you will need to add a container div class="table-module". Check the example below to get the required CSS.

<ods-dataset-context context="population"
                     population-domain="public"
                     population-dataset="population-millesimee-communes-2016">
    <div class="table-module">
        <table class="table-basic"
               ods-results="regions"
               ods-results-context="population"
               ods-results-max="100">
            <thead>
                <tr>
                    <th>Commune</th>
                    <th>Population</th>
                    <th>Code Commune</th>
                    <th>Région</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="region in regions">
                    <th scope="row">
                        {{ region.fields.nom_de_la_commune | capitalize }}
                    </th>
                    <td>
                        {{ region.fields.population_totale }}
                    </td>
                    <td>
                        {{ region.fields.code_commune }}
                    </td>
                    <td>
                        {{ region.fields.nom_de_la_region }}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</ods-dataset-context>
/* Table Module Basic
   ========================================================================== */
.table-module {
  height: 400px;
  overflow-y: auto;
}
.table-basic {
  display: table;
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  background-color: #FFFFFF;
}
.table-basic thead th {
  color: var(--titles);
  background-color: #f6f8fb;
  font-weight: 500;
  padding: 13px 3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-basic thead th:first-child,
.table-basic tbody th {
  padding-left: 13px;
}
.table-basic tr td,
.table-basic tbody th {
  font-weight: normal;
  border-top: 1px solid #dee5ef;
}
.table-basic tr td {
  padding: 13px 3px;
}

Table with detail panel

This table allows clicks in order to open a hidden panel where more information an be displayed. You just need to add the class table-detail to your table. If you want to make the header of the table sticky, you will need to add a container div class="table-module". Check the example below to get the required CSS.

<ods-dataset-context context="population"
                     population-domain="public"
                     population-dataset="population-millesimee-communes-2016">
    <div class="table-module">
        <table class="table-detail"
               ods-results="regions"
               ods-results-context="population"
               ods-results-max="100"
               ng-init="detail.open = ''">
            <thead>
                <tr>
                    <th>Commune</th>
                    <th>Population</th>
                    <th>Code Commune</th>
                    <th>Région</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat-start="(i, region) in regions">
                    <th ng-click="detail.open = (detail.open == region.recordid ? '' : region.recordid)"
                        ng-class="{'table-detail-active': detail.open == region.recordid}"
                        scope="row">
                        {{ region.fields.nom_de_la_commune | capitalize }}
                        <span class="table-row-header-details">
                            - Détails
                            <i class="fa fa-fw" aria-hidden="true"
                               ng-class="{'fa-angle-up': detail.open == region.recordid,
                                         'fa-angle-down': detail.open != region.recordid}"></i>
                        </span>
                    </th>
                    <td>
                        {{ region.fields.population_totale }}
                    </td>
                    <td>
                        {{ region.fields.code_commune }}
                    </td>
                    <td>
                        {{ region.fields.nom_de_la_region }}
                    </td>
                </tr>
                <tr class="table-item-details"
                    ng-repeat-end
                    ng-show="detail.open == region.recordid">
                    <td colspan="4">
                        <ul>
                            <li>
                                <span>Année recensement : </span>
                                <span>{{ region.fields.annee_recensement }}</span>
                            </li>
                            <li ng-if="region.fields.superficie > 0">
                                <span>Superficie de la commune : </span>
                                <span>{{ region.fields.superficie }}</span>
                            </li>
                            <li>
                                <span>Code INSEE de la région : </span>
                                <span>{{ region.fields.code_region }}</span>
                            </li>
                            <li>
                                <span>Code INSEE du département : </span>
                                <span>{{ region.fields.code_departement }}</span>
                            </li>
                        </ul>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</ods-dataset-context>
/* Table with details panel
   ========================================================================== */
.table-module {
  height: 400px;
  overflow-y: auto;
}
.table-detail {
  display: table;
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  background-color: #FFFFFF;
}
.table-detail thead th {
  color: var(--titles);
  background-color: #f6f8fb;
  font-weight: 500;
  padding: 13px 3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-detail thead th:first-child,
.table-detail tbody th {
  padding-left: 13px;
}
.table-detail tr td,
.table-detail tbody th {
  font-weight: normal;
  border-top: 1px solid #dee5ef;
}
.table-detail tr td {
  padding: 13px 3px;
}
/* Summary */
.table-row-header {
  display: flex;
  align-items: center;
}
.table-row-header-details {
  opacity: .8;
  margin: 0 3px;
}
.table-detail tbody tr th:hover {
  color: var(--links);
}
/* Details */
.table-detail-active {
    color: var(--links);
}
.table-item-details {
  padding-bottom: 26px;
}
.table-detail .table-item-details td {
  border-top: none;
}
.table-detail .table-item-details td:first-child {
  padding-left: 13px;
}

Table with dropdown

This table has a button that opens a dropdown menu, where actions or links can be added. You need to add the table-basic class to your table. If you want to make the header of the table sticky, you will need to add a container div class="table-module". Check the example below to get the required CSS and HTML in order to get the dropdown button working.

<ods-dataset-context context="population"
                     population-domain="public"
                     population-dataset="population-millesimee-communes-2016">
    <div class="table-module">
        <table class="table-basic"
               ods-results="regions"
               ods-results-context="population"
               ods-results-max="100"
               ng-init="dropdown.open = ''">
            <thead>
                <tr>
                    <th>Commune</th>
                    <th>Population</th>
                    <th>Code Commune</th>
                    <th>Région</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="region in regions">
                    <th scope="row">
                        {{ region.fields.nom_de_la_commune | capitalize }}
                    </th>
                    <td>
                        {{ region.fields.population_totale }}
                    </td>
                    <td>
                        {{ region.fields.code_commune }}
                    </td>
                    <td>
                        {{ region.fields.nom_de_la_region }}
                    </td>
                    <td>
                        <div class="table-dropdown-container">
                            <button class="table-dropdown-button"
                                    ng-click="dropdown.open = (dropdown.open == region.recordid ? '' : region.recordid)"
                                    ng-class="{'table-dropdown-button-active': dropdown.open == region.recordid}">
                                <i class="fa fa-ellipsis-v"></i>
                            </button>
                            <div class="table-dropdown"
                                 ng-class="{'table-dropdown-visible' : dropdown.open == region.recordid }">
                                <a href="#"
                                   target="_blank"
                                   class="table-dropdown-item">
                                    Action 1
                                </a>
                                <a href="#"
                                   target="_blank"
                                   class="table-dropdown-item">
                                    Action 2
                                </a>
                            </div>
                            <div class="table-dropdown-backdrop"
                                 ng-click="dropdown.open = ''"
                                 ng-show="dropdown.open != ''"></div>
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</ods-dataset-context>
/* Table with dropdown
   ========================================================================== */
.table-module {
  height: 400px;
  overflow-y: auto;
}
.table-basic {
  display: table;
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  background-color: #FFFFFF;
}
.table-basic thead th {
  color: var(--titles);
  background-color: #f6f8fb;
  font-weight: 500;
  padding: 13px 3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-basic thead th:first-child,
.table-basic tbody th {
  padding-left: 13px;
}
.table-basic tr td,
.table-basic tbody th {
  font-weight: normal;
  border-top: 1px solid #dee5ef;
}
.table-basic tr td {
  padding: 13px 3px;
}
/* Dropdown */
.table-dropdown-container {
  position: relative;
  margin-right: 4px;;
}
.table-dropdown-button {
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-left: auto;
}
.table-basic tr:hover .table-dropdown-button {
  border-color: var(--highlight);
}
.table-dropdown-button-active {
  box-shadow: 0 0 0 3px rgba(20, 46, 123, 0.3);
  border-color: var(--highlight);
}
.table-dropdown {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  border: 1px solid #FFFFFF;
  border-radius: 4px;
  border-color: rgba(222, 229, 239, 1);
  padding: 13px;
  white-space: nowrap;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: visibility 0s, opacity 0.1s ease, top 0.1s ease;
}
.table-dropdown-visible {
  visibility: visible;
  opacity: 1;
  top: 38px;
}
.table-dropdown-item {
  padding: 2px 6px 2px 0;
  display: block;
}
.table-dropdown-backdrop {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  cursor: auto;
}

Advanced table

This table includes all the functionality presented in the previous examples. This table has a details panel, a dropdown button for actions and a sticky header. You need to add the table-advanced class to your table. If you want to make the header of the table sticky, you will need to add a container div class="table-module".

<ods-dataset-context context="population"
                     population-domain="public"
                     population-dataset="population-millesimee-communes-2016">
    <div class="table-module">
        <table class="table-advanced"
               ods-results="regions"
               ods-results-context="population"
               ods-results-max="100"
               ng-init="dropdown.open = ''; detail.open = ''">
            <thead>
                <tr>
                    <th>Commune</th>
                    <th>Population</th>
                    <th>Code Commune</th>
                    <th>Région</th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat-start="(i, region) in regions">
                    <th ng-click="detail.open = (detail.open == region.recordid ? '' : region.recordid)"
                        ng-class="{'table-detail-active': detail.open == region.recordid}"
                        scope="row">
                        {{ region.fields.nom_de_la_commune | capitalize }}
                        <span class="table-row-header-details">
                            - Détails
                            <i class="fa fa-fw" aria-hidden="true"
                               ng-class="{'fa-angle-up': detail.open == region.recordid,
                                         'fa-angle-down': detail.open != region.recordid}"></i>
                        </span>
                    </th>
                    <td>
                        {{ region.fields.population_totale }}
                    </td>
                    <td>
                        {{ region.fields.code_commune }}
                    </td>
                    <td>
                        {{ region.fields.nom_de_la_region }}
                    </td>
                    <td>
                        <div class="table-dropdown-container">
                            <button class="table-dropdown-button"
                                    ng-click="dropdown.open = (dropdown.open == region.recordid ? '' : region.recordid)"
                                    ng-class="{'table-dropdown-button-active': dropdown.open == region.recordid}">
                                <i class="fa fa-ellipsis-v"></i>
                            </button>
                            <div class="table-dropdown"
                                 ng-class="{'table-dropdown-visible' : dropdown.open == region.recordid }">
                                <a href="#"
                                   target="_blank"
                                   class="table-dropdown-item">
                                    Action 1
                                </a>
                                <a href="#"
                                   target="_blank"
                                   class="table-dropdown-item">
                                    Action 2
                                </a>
                            </div>
                            <div class="table-dropdown-backdrop"
                                 ng-click="dropdown.open = ''"
                                 ng-show="dropdown.open != ''"></div>
                        </div>
                    </td>
                </tr>
                <tr class="table-item-details"
                    ng-repeat-end
                    ng-show="detail.open == region.recordid">
                    <td colspan="4">
                        <ul>
                            <li>
                                <span>Année recensement : </span>
                                <span>{{ region.fields.annee_recensement }}</span>
                            </li>
                            <li ng-if="region.fields.superficie > 0">
                                <span>Superficie de la commune : </span>
                                <span>{{ region.fields.superficie }}</span>
                            </li>
                            <li>
                                <span>Code INSEE de la région : </span>
                                <span>{{ region.fields.code_region }}</span>
                            </li>
                            <li>
                                <span>Code INSEE du département : </span>
                                <span>{{ region.fields.code_departement }}</span>
                            </li>
                        </ul>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</ods-dataset-context>
/* Table Advanced
   ========================================================================== */
.table-module {
  height: 400px;
  overflow-y: auto;
}
.table-advanced {
  display: table;
  border-collapse: collapse;
  width: 100%;
  white-space: nowrap;
  background-color: #FFFFFF;
}
.table-advanced thead th {
  color: var(--titles);
  background-color: #f6f8fb;
  font-weight: 500;
  padding: 13px 3px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-advanced thead th:first-child,
.table-advanced tbody th {
  padding-left: 13px;
}
.table-advanced tr td,
.table-advanced tbody th {
  font-weight: normal;
  border-top: 1px solid #dee5ef;
}
.table-advanced tr td {
  padding: 13px 3px;
}
/* Dropdown */
.table-dropdown-container {
  position: relative;
  margin-right: 4px;;
}
.table-dropdown-button {
  width: 28px;
  height: 28px;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-left: auto;
}
.table-advanced tr:hover .table-dropdown-button {
  border-color: var(--highlight);
}
.table-dropdown-button-active {
  box-shadow: 0 0 0 3px rgba(20, 46, 123, 0.3);
  border-color: var(--highlight);
}
.table-dropdown {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  border: 1px solid #FFFFFF;
  border-radius: 4px;
  border-color: rgba(222, 229, 239, 1);
  padding: 13px;
  white-space: nowrap;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: visibility 0s, opacity 0.1s ease, top 0.1s ease;
}
.table-dropdown-visible {
  visibility: visible;
  opacity: 1;
  top: 38px;
}
.table-dropdown-item {
  padding: 2px 6px 2px 0;
  display: block;
}
.table-dropdown-backdrop {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  cursor: auto;
}
/* Summary */
.table-row-header {
  display: flex;
  align-items: center;
}
.table-row-header-details {
  opacity: .8;
  margin: 0 3px;
}
/* Details */
.table-advanced tbody tr th:hover {
  color: var(--links);
}
.table-advanced-active {
    color: var(--links);
}
.table-item-details {
  padding-bottom: 26px;
}
.table-advanced .table-item-details td {
  border-top: none;
}
.table-advanced .table-item-details td:first-child {
  padding-left: 13px;
}