Euro indicators 5 July 2024 Next release: 6 August 2024
May 2024 compared with April 2024
Skip to the content
Up by 0.3% in the euro area and by 0.6% in the EU compared with May 2023
Overview
In May 2024, compared with April 2024, the seasonally adjusted retail trade volume increased by 0.1% in both the euro area and the EU, according to first estimates from Eurostat, the statistical office of the European Union.
In April 2024, retail trade volume fell by 0.2% in both the euro area and the EU.
In May 2024, compared with May 2023, the calendar adjusted retail sales index increased by 0.3% the euro area and by 0.6% in the EU.
Monthly comparison by retail sector and by Member State
In the euro area in May 2024, compared with April 2024, the volume of retail trade
increased for food, drinks, tobacco by 0.7%,
decreased for non-food products (except automotive fuel) by 0.2%,
increased for automotive fuel in specialised stores by 0.4%.
In the EU, the volume of retail trade
increased for food, drinks, tobacco by 1.2%,
decreased for non-food products (except automotive fuel) by 0.4%,
remained stable for automotive fuel in specialised stores.
Among Member States for which data are available, the highest monthly increases in the total retail trade volume were recorded in Denmark (+2.3%), Lithuania (+1.8%) and Luxembourg (+1.7%). The largest decreases were observed in Slovakia (-1.0%), Ireland (-0.9%), Bulgaria and Malta (both -0.8%).
Annual comparison by retail sector and by Member State
In the euro area in May 2024, compared with May 2023, the volume of retail trade
increased for food, drinks, tobacco by 0.3%,
increased for non-food products (except automotive fuel) by 0.7%,
decreased for automotive fuel in specialised stores by 0.6%.
In the EU, the volume of retail trade
increased for food, drinks, tobacco by 0.7%,
increased for non-food products (except automotive fuel) by 0.9%,
decreased for automotive fuel in specialised stores by 0.8%.
Among Member States for which data are available, the highest annual increases in the total retail trade volume were recorded in Luxembourg (+10.4%), Croatia (+8.4%) and Romania (+6.5%). The largest decreases were observed in Belgium (-5.2%), Estonia (-4.0%) and Slovenia (-1.1%).
Tables
Volume of retail trade % change compared with the previous month* | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | ||||||
Total retail trade | -0.5 | 0.0 | -0.1 | 0.7 | -0.2 | 0.1 |
Food, drinks, tobacco | -0.6 | 0.3 | -0.3 | 1.1 | -0.9 | 0.7 |
Non-food products (except automotive fuel) | -0.6 | 0.3 | 0.4 | 0.0 | 0.5 | -0.2 |
Automotive fuel in specialised stores | 0.4 | 0.5 | -1.0 | 0.8 | -0.7 | 0.4 |
EU | ||||||
Total retail trade | -0.5 | 0.3 | 0.0 | 0.5 | -0.2 | 0.1 |
Food, drinks, tobacco | -0.4 | 0.4 | -0.2 | 0.8 | -1.1 | 1.2 |
Non-food products (except automotive fuel) | -0.7 | 0.4 | 0.5 | -0.1 | 0.6 | -0.4 |
Automotive fuel in specialised stores | 0.7 | 0.2 | 0.1 | 0.3 | -0.7 | 0.0 |
* Calendar and seasonally adjusted Source dataset: sts_trtu_m |
Volume of retail trade % change compared with the previous month* | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | -0.5 | 0.0 | -0.1 | 0.7 | -0.2 | 0.1 |
EU | -0.5 | 0.3 | 0.0 | 0.5 | -0.2 | 0.1 |
Belgium | -1.9 | -0.7 | -2.0 | 0.5 | -0.5 | 0.4 |
Bulgaria | -0.7 | 0.8 | 0.4 | 0.1 | 1.3 | -0.8 |
Czechia | 0.2 | 1.4 | -0.3 | 1.3 | -0.1 | c |
Denmark | -0.3 | -1.6 | 1.3 | 0.0 | -2.9 | 2.3 |
Germany | -0.2 | -0.3 | -1.5 | 2.7 | -0.2 | : |
Estonia | 0.2 | -2.4 | 1.1 | 0.4 | -1.1 | -0.6 |
Ireland | 1.2 | 0.0 | 0.1 | 0.1 | 0.7 | -0.9 |
Greece | 2.2 | -6.3 | 0.5 | 6.3 | -5.8 | c |
Spain | -0.8 | -0.5 | 0.6 | -0.5 | 0.8 | -0.6 |
France | -0.8 | 0.8 | 0.5 | -0.2 | -0.2 | -0.2 |
Croatia | 0.8 | 0.5 | 0.8 | 0.5 | 0.7 | 0.6 |
Italy | -0.6 | 0.1 | 0.0 | 0.1 | -0.2 | 0.1 |
Cyprus | 0.5 | 1.8 | -1.9 | 2.2 | -1.1 | 1.6 |
Latvia | 1.0 | -1.3 | 0.5 | 0.8 | -2.2 | 0.3 |
Lithuania | 0.1 | 0.8 | 0.8 | 1.6 | -1.3 | 1.8 |
Luxembourg | 3.2 | 0.8 | 3.7 | 0.2 | -4.0 | 1.7 |
Hungary | 1.5 | 0.1 | -0.3 | 1.9 | -0.9 | 0.0 |
Malta | -1.1 | 0.1 | 0.8 | -1.1 | 1.3 | -0.8 |
Netherlands | -0.5 | 1.2 | 0.7 | -0.5 | -1.2 | 0.8 |
Austria | -1.5 | 1.0 | 0.4 | -0.7 | 2.0 | -0.7 |
Poland | -0.8 | 1.8 | 0.7 | -1.0 | -0.9 | -0.4 |
Portugal | 0.3 | -0.2 | 0.4 | -0.1 | 2.0 | 0.3 |
Romania | -0.4 | 4.6 | -0.3 | 1.0 | 0.6 | -0.3 |
Slovenia | -0.3 | -1.4 | -0.2 | 2.3 | -0.7 | -0.4 |
Slovakia | 2.0 | -1.3 | 1.0 | -0.6 | 2.4 | -1.0 |
Finland | -1.0 | 0.2 | 0.2 | 0.8 | -1.4 | 1.2 |
Sweden | -0.5 | 0.1 | 2.7 | -2.1 | 0.6 | 0.4 |
Norway | -0.9 | 0.1 | 0.2 | 0.4 | 0.2 | 3.2 |
Switzerland | -0.3 | 0.8 | 0.0 | -0.2 | 0.0 | 0.2 |
* Calendar and seasonally adjusted : Data not available c Confidential Source dataset: sts_trtu_m |
Volume of retail trade % change compared with the same month of the previous year* | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | ||||||
Total retail trade | -0.4 | -0.9 | -0.3 | 0.6 | 0.6 | 0.3 |
Food, drinks, tobacco | -0.1 | -1.3 | -1.2 | 1.0 | -0.3 | 0.3 |
Non-food products (except automotive fuel) | -0.2 | -0.7 | 0.7 | 0.7 | 1.2 | 0.7 |
Automotive fuel in specialised stores | -3.4 | 0.6 | -1.5 | -1.0 | 1.1 | -0.6 |
EU | ||||||
Total retail trade | -0.5 | -0.6 | 0.2 | 1.4 | 0.4 | 0.6 |
Food, drinks, tobacco | 0.3 | -0.7 | -0.5 | 1.3 | 0.0 | 0.7 |
Non-food products (except automotive fuel) | 0.0 | -0.5 | 1.1 | 1.7 | 0.8 | 0.9 |
Automotive fuel in specialised stores | -5.0 | -0.5 | -1.0 | -1.0 | 0.9 | -0.8 |
* Calendar adjusted Source dataset: sts_trtu_m |
Volume of retail trade % change compared with the same month of the previous year* | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | -0.4 | -0.9 | -0.3 | 0.6 | 0.6 | 0.3 |
EU | -0.5 | -0.6 | 0.2 | 1.4 | 0.4 | 0.6 |
Belgium | -3.7 | -3.8 | -6.8 | -4.6 | -5.8 | -5.2 |
Bulgaria | 0.8 | -0.1 | 3.1 | 0.4 | 9.8 | 1.6 |
Czechia | 1.2 | 3.3 | 2.5 | 5.8 | 5.3 | c |
Denmark | 4.6 | 0.7 | 2.1 | 2.7 | -1.7 | -0.3 |
Germany | -0.5 | -1.2 | -2.3 | 1.0 | 0.3 | : |
Estonia | -4.3 | -6.7 | -3.5 | -2.3 | -4.9 | -4.0 |
Ireland | 1.5 | 1.2 | 1.1 | 1.5 | 0.9 | -0.7 |
Greece | 0.8 | -9.3 | -9.5 | 5.3 | -6.3 | c |
Spain | 2.7 | 0.3 | 1.8 | 0.6 | 0.6 | 0.0 |
France | -0.5 | 0.4 | 1.5 | 0.7 | 2.6 | 1.4 |
Croatia | 8.5 | 7.9 | 9.1 | 8.9 | 8.6 | 8.4 |
Italy | -2.3 | -2.6 | -0.6 | -1.3 | -1.0 | -0.8 |
Cyprus | 3.8 | 6.1 | 0.6 | 5.0 | 1.9 | 3.8 |
Latvia | 1.6 | -1.4 | -0.3 | 2.6 | 0.4 | 1.0 |
Lithuania | 3.3 | -0.7 | 2.6 | 6.2 | 2.4 | 5.1 |
Luxembourg | 7.5 | 10.2 | 16.5 | 16.3 | 9.4 | 10.4 |
Hungary | -0.3 | 0.6 | 1.7 | 4.1 | 3.2 | 3.7 |
Malta | -0.3 | 1.6 | 4.4 | -1.0 | 4.0 | -0.2 |
Netherlands | 0.6 | 0.9 | 2.5 | 3.2 | 1.5 | 2.3 |
Austria | -3.8 | -2.1 | -1.0 | -1.9 | 1.8 | 0.7 |
Poland | -2.7 | -1.6 | 2.2 | 8.2 | -7.3 | -0.8 |
Portugal | 0.7 | 0.2 | 1.2 | 0.9 | 1.8 | 2.7 |
Romania | 1.5 | 7.5 | 7.4 | 5.7 | 9.9 | 6.5 |
Slovenia | -3.4 | -1.9 | -4.4 | -0.5 | 0.2 | -1.1 |
Slovakia | -3.3 | 1.7 | 4.3 | 1.3 | 8.6 | 5.3 |
Finland | -1.7 | -2.8 | -2.3 | 0.6 | -3.6 | -0.8 |
Sweden | -3.0 | -3.1 | 2.4 | 0.0 | 0.5 | 1.5 |
Norway | -0.2 | -1.1 | -0.1 | 0.8 | 1.0 | 3.4 |
Switzerland | 0.1 | 0.1 | -0.1 | -0.2 | 2.2 | 0.4 |
* Calendar adjusted : Data not available c Confidential Source dataset: sts_trtu_m |
Volume of retail trade, calendar and seasonally adjusted indices (base year 2021) | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | 98.9 | 98.9 | 98.8 | 99.5 | 99.3 | 99.4 |
EU | 99.2 | 99.5 | 99.5 | 100.0 | 99.8 | 99.9 |
Belgium | 87.0 | 86.4 | 84.7 | 85.1 | 84.7 | 85.0 |
Bulgaria | 106.5 | 107.4 | 107.8 | 107.9 | 109.3 | 108.4 |
Czechia | 93.3 | 94.6 | 94.3 | 95.5 | 95.4 | c |
Denmark | 94.3 | 92.8 | 94.0 | 94.0 | 91.3 | 93.4 |
Germany | 96.0 | 95.7 | 94.3 | 96.8 | 96.6 | : |
Estonia | 92.5 | 90.3 | 91.3 | 91.7 | 90.7 | 90.2 |
Ireland | 101.8 | 101.8 | 101.9 | 102.0 | 102.7 | 101.8 |
Greece | 100.5 | 94.2 | 94.7 | 100.7 | 94.9 | c |
Spain | 105.2 | 104.7 | 105.3 | 104.8 | 105.6 | 105.0 |
France | 101.4 | 102.2 | 102.7 | 102.5 | 102.3 | 102.1 |
Croatia | 109.3 | 109.9 | 110.8 | 111.3 | 112.1 | 112.8 |
Italy | 97.3 | 97.4 | 97.4 | 97.5 | 97.3 | 97.4 |
Cyprus | 111.7 | 113.7 | 111.5 | 114.0 | 112.8 | 114.6 |
Latvia | 104.3 | 102.9 | 103.4 | 104.2 | 101.9 | 102.2 |
Lithuania | 99.9 | 100.7 | 101.5 | 103.1 | 101.8 | 103.6 |
Luxembourg | 111.2 | 112.1 | 116.3 | 116.5 | 111.8 | 113.7 |
Hungary | 98.6 | 98.7 | 98.4 | 100.3 | 99.4 | 99.4 |
Malta | 112.6 | 112.7 | 113.6 | 112.4 | 113.9 | 113.0 |
Netherlands | 99.9 | 101.1 | 101.8 | 101.3 | 100.1 | 100.9 |
Austria | 94.1 | 95.0 | 95.4 | 94.7 | 96.6 | 95.9 |
Poland | 106.4 | 108.3 | 109.1 | 108.0 | 107.0 | 106.6 |
Portugal | 106.9 | 106.7 | 107.1 | 107.0 | 109.1 | 109.4 |
Romania | 108.4 | 113.4 | 113.1 | 114.2 | 114.9 | 114.5 |
Slovenia | 99.2 | 97.8 | 97.6 | 99.8 | 99.1 | 98.7 |
Slovakia | 102.3 | 101.0 | 102.0 | 101.4 | 103.8 | 102.8 |
Finland | 91.6 | 91.8 | 92.0 | 92.7 | 91.4 | 92.5 |
Sweden | 92.7 | 92.8 | 95.3 | 93.3 | 93.9 | 94.3 |
Norway | 92.0 | 92.1 | 92.3 | 92.7 | 92.9 | 95.9 |
Switzerland | 98.2 | 99.0 | 99.0 | 98.8 | 98.8 | 99.0 |
: Data not available c Confidential Source dataset: sts_trtu_m |
Volume of retail trade, calendar adjusted indices (base year 2021) | ||||||
---|---|---|---|---|---|---|
Dec-23 | Jan-24 | Feb-24 | Mar-24 | Apr-24 | May-24 | |
Euro area | 115.5 | 92.9 | 87.8 | 97.9 | 96.0 | 99.2 |
EU | 115.5 | 92.6 | 88.1 | 98.6 | 96.9 | 100.1 |
Belgium | 102.2 | 84.0 | 74.8 | 84.5 | 83.2 | 86.8 |
Bulgaria | 118.5 | 98.5 | 96.5 | 104.3 | 108.3 | 106.4 |
Czechia | 114.5 | 85.1 | 81.3 | 92.9 | 91.0 | c |
Denmark | 108.7 | 85.4 | 81.9 | 92.2 | 90.8 | 98.5 |
Germany | 107.3 | 88.1 | 85.1 | 98.5 | 96.2 | : |
Estonia | 104.7 | 81.2 | 77.6 | 90.8 | 87.3 | 93.5 |
Ireland | 137.8 | 94.3 | 95.1 | 93.1 | 98.0 | 96.3 |
Greece | 111.0 | 85.8 | 89.1 | 95.7 | 93.0 | c |
Spain | 122.0 | 104.1 | 92.0 | 101.3 | 101.3 | 104.1 |
France | 123.1 | 97.6 | 90.8 | 99.8 | 99.1 | 100.0 |
Croatia | 111.8 | 89.2 | 88.7 | 102.6 | 106.8 | 113.4 |
Italy | 117.8 | 91.5 | 87.1 | 94.1 | 88.2 | 97.4 |
Cyprus | 136.5 | 102.5 | 97.0 | 109.4 | 109.1 | 111.9 |
Latvia | 115.5 | 91.4 | 87.9 | 100.8 | 98.1 | 104.6 |
Lithuania | 112.2 | 90.0 | 87.3 | 101.1 | 99.9 | 107.7 |
Luxembourg | 129.4 | 108.3 | 107.8 | 120.9 | 107.1 | 113.1 |
Hungary | 116.9 | 85.6 | 85.2 | 98.3 | 95.5 | 99.3 |
Malta | 126.5 | 101.9 | 100.1 | 107.7 | 110.4 | 115.5 |
Netherlands | 110.7 | 95.8 | 89.2 | 100.5 | 98.6 | 105.0 |
Austria | 108.1 | 86.8 | 85.7 | 96.8 | 97.5 | 94.6 |
Poland | 122.3 | 97.4 | 96.8 | 111.7 | 107.7 | 107.6 |
Portugal | 128.1 | 98.0 | 92.6 | 102.7 | 102.2 | 107.7 |
Romania | 122.1 | 100.4 | 97.6 | 110.6 | 113.6 | 114.4 |
Slovenia | 109.6 | 89.5 | 85.2 | 101.3 | 98.7 | 97.5 |
Slovakia | 113.5 | 91.6 | 93.0 | 102.9 | 101.0 | 103.9 |
Finland | 104.1 | 80.2 | 76.9 | 88.6 | 88.3 | 96.8 |
Sweden | 103.0 | 81.5 | 80.6 | 91.1 | 93.2 | 100.9 |
Norway | 108.1 | 82.7 | 77.7 | 88.2 | 87.5 | 102.8 |
Switzerland | 118.0 | 92.6 | 87.9 | 99.6 | 95.6 | 101.5 |
: Data not available c Confidential Source dataset: sts_trtu_m |
Notes for users
Revisions and timetable
Data of previous months have been revised compared to those issued in the News Release of 6 June 2024. The monthly percentage change for April 2024 has been revised from -0.5% to -0.2% in the euro area and from -0.6% to -0.2% in theEU. The annual percentage change has been revised from 0.0% to +0.6% in the euro area and from -0.1% to +0.4% in the EU.
Methods and definitions
The index of the volume of retail trade measures the evolution of the turnover in retail trade, adjusted for price changes (deflated), i.e. the evolution of the total amount of goods sold, based on data adjusted for calendar and seasonal effects.
Seasonally adjusted euro area and EU series are calculated by aggregating the seasonally adjusted national data.
Missing observations from Member States for recent months are estimated for the calculation of the euro area and the EU aggregates.
Starting with reference period January 2024, the base year of the data has been changed to 2021, since 2018 the base year had been 2015. More information on the reasons for and impact of the base year change can be found in the related Statistics Explained article.
Geographical information
The euro area (EA20) includes Belgium, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Malta, the Netherlands, Austria, Portugal, Slovenia, Slovakia and Finland.
The European Union (EU27) includes Belgium, Bulgaria, Czechia, Denmark, Germany, Estonia, Ireland, Greece, Spain, France, Croatia, Italy, Cyprus, Latvia, Lithuania, Luxembourg, Hungary, Malta, the Netherlands, Austria, Poland, Portugal, Romania, Slovenia, Slovakia, Finland and Sweden.
For more information
Database section on short-term business statistics
Statistics Explained article on the index of retail trade
The weights of the Member States in the EU and euro area aggregates
(See file Base year 2021 weights - Euro indicators releases)Euro indicators dashboard
Release calendar for Euro indicators
European Statistics Code of Practice
Get in touch
Media requests
Eurostat Media Support
Phone: (+352) 4301 33 408
E-mail: eurostat-mediasupport@ec.europa.eu
Further information on data
E-mail: ESTAT-STS-DATA@ec.europa.eu
Share component will be rendered here.
'; /** Retrieve the order from the tooltip option */ var sortOrder = option.tooltip.order; /** Sort the 'params' array based on the 'sortOrder' parameter. */ switch (sortOrder) { /** Sort by series name in ascending order. */ case 'seriesAsc': params = params.sort((a, b) => a.seriesName.localeCompare(b.seriesName)); break; /** Sort by series name in descending order. */ case 'seriesDesc': params = params.sort((a, b) => b.seriesName.localeCompare(a.seriesName)); break; /** Sort by numerical value in ascending order. */ case 'valueAsc': params = params.sort((a, b) => parseFloat(a.value) - parseFloat(b.value)); break; /** Sort by numerical value in descending order. */ case 'valueDesc': params = params.sort((a, b) => parseFloat(b.value) - parseFloat(a.value)); break; /** Reverse the current order. */ case 'reverse': params.reverse(); break; default: break; } /** Iterate over each series in the tooltip parameters */ for (var i = 0; i < params.length; i++) { /** Retrieve the name and value of the current series */ var seriesName = params[i].seriesName; var value = params[i].value; /** Replace every specific apostrphe by simple one. */ seriesName = seriesName.replaceAll("’", "'"); /** Convert the numeric value to its string representation. */ var strValue = String(value); /** Retrieve the axis used as value */ var axis = option.yAxis.type === 'value' ? option.yAxis : option.xAxis; /** Initialize the number of decimal places */ var decimals = option.tooltip.decimals; /** Check if decimals configuration is set to default and the value contains decimal places */ if (!decimals && strValue.indexOf('.') > -1) { /** Calculate the number of decimal places */ decimals = strValue.substring(strValue.indexOf('.'), strValue.length - 1).length; } else { /** If there are no decimal places, format the value with 1 decimal place */ decimals = decimals ? decimals : 1; /** Convert the value to a fixed-point notation string with a specified number of decimal places. */ value = Number(value).toFixed(decimals); } /** Convert -0 value to 0 with the specified or calculated number of decimal places.*/ if (Number(value) == -0) { value = (Number(value) + 0).toFixed(decimals); } /** Extract the unit from within the axis label */ var unit = axis.axisLabel.unit ? axis.axisLabel.unit : ''; /** Format the value using the appropriate number of decimal places */ value = isNaN(value) ? 'N/A' : Number(value).toLocaleString(option.lang ? option.lang : 'en', { minimumFractionDigits: decimals }) + unit; /** Retrieve the color of the current series */ const color = params[i].color; /** * Add the series name and value to the tooltip content * Use a circle icon with the series color */ tooltipContent += '
' + '' + '' + '' + seriesName + '' + '' + '' + value + '' + '
'; } /** Close the tooltip content container */ tooltipContent += '
'; /** Return the formatted tooltip content */ return tooltipContent; }}/* * This content is licensed according to the W3C Software License at * https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document * * File: sortable-table.js * * Desc: Adds sorting to a HTML data table that implements ARIA Authoring Practices */'use strict';class SortableTable { constructor(tableNode) { this.tableNode = tableNode; this.columnHeaders = tableNode.querySelectorAll('thead th.sortable'); this.sortColumns = []; for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (buttonNode) { this.sortColumns.push(i); // buttonNode.setAttribute('data-column-index', i); // buttonNode.addEventListener('click', this.handleClick.bind(this)); ch.setAttribute('data-column-index', i); ch.addEventListener('click', this.handleClick.bind(this)); } } this.optionCheckbox = document.querySelector( 'input[type="checkbox"][value="show-unsorted-icon"]' ); if (this.optionCheckbox) { this.optionCheckbox.addEventListener( 'change', this.handleOptionChange.bind(this) ); if (this.optionCheckbox.checked) { this.tableNode.classList.add('show-unsorted-icon'); } } } setColumnHeaderSort(columnIndex) { if (typeof columnIndex === 'string') { columnIndex = parseInt(columnIndex); } for (var i = 0; i < this.columnHeaders.length; i++) { var ch = this.columnHeaders[i]; var buttonNode = ch.querySelector('button'); if (i === columnIndex) { var value = ch.getAttribute('aria-sort'); if (value === 'ascending') { ch.setAttribute('aria-sort', 'descending'); this.sortColumn( columnIndex, 'descending', ch.classList.contains('num')); } else if (value === 'descending') { ch.removeAttribute('aria-sort'); this.sortColumn( columnIndex, 'initial', true ); } else { ch.setAttribute('aria-sort', 'ascending'); this.sortColumn( columnIndex, 'ascending', ch.classList.contains('num') ); } } else { if (ch.hasAttribute('aria-sort') && buttonNode) { ch.removeAttribute('aria-sort'); } } } } sortColumn(columnIndex, sortValue, isNumber) { function compareValues(a, b) { if (a.value === b.value) return 0; if (sortValue === 'descending') { return isNumber ? b.value - a.value : (a.value > b.value ? -1 : 1); } else { return isNumber ? a.value - b.value : (a.value < b.value ? -1 : 1); } } if (typeof isNumber !== 'boolean') { isNumber = false; } var tbodyNode = this.tableNode.querySelector('tbody'); var rowNodes = []; var dataCells = []; var rowNode = tbodyNode.firstElementChild; var index = 0; while (rowNode) { rowNodes.push(rowNode); var rowCells = rowNode.querySelectorAll('th, td'); var dataCell = rowCells[columnIndex]; var data = {}; data.index = index; if (sortValue !== 'initial') { data.value = dataCell.textContent.toLowerCase().trim(); } else { data.value = rowNode.getAttribute('initial-position').toLowerCase().trim(); } if (isNumber) { data.value = parseFloat(data.value); } dataCells.push(data); rowNode = rowNode.nextElementSibling; index += 1; } dataCells.sort(compareValues); // remove rows while (tbodyNode.firstChild) { tbodyNode.removeChild(tbodyNode.lastChild); } // add sorted rows for (var i = 0; i < dataCells.length; i += 1) { let pos = [dataCells[i].index]; if (sortValue === "initial") { rowNodes[pos].classList.remove("sorted"); } else { rowNodes[pos].classList.add("sorted"); } tbodyNode.appendChild(rowNodes[pos]); } } /* EVENT HANDLERS */ handleClick(event) { var tgt = event.currentTarget; this.setColumnHeaderSort(tgt.getAttribute('data-column-index')); } handleOptionChange(event) { var tgt = event.currentTarget; if (tgt.checked) { this.tableNode.classList.add('show-unsorted-icon'); } else { this.tableNode.classList.remove('show-unsorted-icon'); } }}$(document).ready(function() { load(); });;}());
Subscribe to receive the latest Eurostat Euro indicators releases