From 3dafb45c0be2e5ae555069bddb7d7f521ca41090 Mon Sep 17 00:00:00 2001
From: florenttorregrosa <florenttorregrosa@2388214.no-reply.drupal.org>
Date: Sun, 20 Mar 2016 14:41:28 +0100
Subject: [PATCH] Issue #2690921 by Grimreaper: Views table header not sortable

---
 templates/views/views-view-table.html.twig | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/templates/views/views-view-table.html.twig b/templates/views/views-view-table.html.twig
index 5926bd2..e4855df 100644
--- a/templates/views/views-view-table.html.twig
+++ b/templates/views/views-view-table.html.twig
@@ -59,9 +59,31 @@
   {% if header %}
     <thead>
       <tr>
-        {% for column in header %}
-          <th{{ column.attributes }} scope="col">
-            {{ column.content }}
+        {% for key, column in header %}
+          {% if column.default_classes %}
+            {%
+            set column_classes = [
+            'views-field',
+            'views-field-' ~ fields[key],
+            ]
+            %}
+          {% endif %}
+          <th{{ column.attributes.addClass(column_classes).setAttribute('scope', 'col') }}>
+            {%- if column.wrapper_element -%}
+              <{{ column.wrapper_element }}>
+              {%- if column.url -%}
+                <a href="{{ column.url }}" title="{{ column.title }}">{{ column.content }}{{ column.sort_indicator }}</a>
+              {%- else -%}
+                {{ column.content }}{{ column.sort_indicator }}
+              {%- endif -%}
+              </{{ column.wrapper_element }}>
+            {%- else -%}
+              {%- if column.url -%}
+                <a href="{{ column.url }}" title="{{ column.title }}">{{ column.content }}{{ column.sort_indicator }}</a>
+              {%- else -%}
+                {{- column.content }}{{ column.sort_indicator }}
+              {%- endif -%}
+            {%- endif -%}
           </th>
         {% endfor %}
       </tr>
-- 
2.1.4

