diff --git a/amd/build/suivi-table.js b/amd/build/suivi-table.js
new file mode 100644
index 0000000000000000000000000000000000000000..0ec10d878cee9e18a4d8f6cf3e9a7b03e4b839a9
--- /dev/null
+++ b/amd/build/suivi-table.js
@@ -0,0 +1,211 @@
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Handle add/remove competency links.
+ *
+ * @module     format_iena/suivi-table
+ * @package    format_iena
+ * @copyright  2021 Myriam Delaruelle
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
+       function($, ajax, templates, str) {
+       	var all_selected=false;
+       	var data=[];
+       	return{
+       		registerSelectAll:function(){
+
+       			$('#iena-select-all').on('click', function(e){
+	    			select_all_studs(e);
+	    		});
+	    		
+	    		
+       		},
+       		
+       		registerSubmit:function(data){
+       			$("#id_submit_iena").off().on('click', function(e){
+	    			triggerAction(e, data);
+	    		})
+       		}
+       		
+       	}
+
+   
+    function select_all_studs(e) {
+		all_selected=!all_selected;
+		var counter = 0;
+		var checks = document.querySelectorAll("#table-body tr");
+		for (var i = 0; i < checks.length; i++) {
+			if ( checks[i].style.display != "none" || all_selected ) {
+				var box = checks[i].querySelector("input[type='checkbox']");
+				box.checked = all_selected;
+				counter++;
+			}
+		}
+	}
+
+
+	function getSelectedStudents(){
+		var selectedChecks=$("#table-body input:checked");
+		var students=[];
+		for(var i=0; i < selectedChecks.length; i++){
+			
+			students.push(selectedChecks[i].value);
+		}
+	
+		return students;
+
+	}
+
+
+	function triggerAction(e, data){
+		value=$("#select-actions-suivi-iena").val();
+		
+		if(value=="msg"){
+			console.log("on va envoyer un message");
+		}
+		else if(value=="download"){
+			table_download(data);
+		}
+	}
+
+
+	function slug_it(str) {
+		return str.toString().toLowerCase().trim()
+		.replace(/\s+/g, '-')           /* Replace spaces with - */
+		.replace(/&/g, '-and-')         /* Replace & with 'and' */
+		.replace(/[^\w\-]+/g, '')       /* Remove all non-word chars */
+		.replace(/\-\-+/g, '-');        /* Replace multiple - with single - */
+	}
+
+
+	function padLeft(date){
+		
+		return String(date).length > 1? date : '0'+date ;
+	}
+
+	/*Number.prototype.padLeft = function(base,chr){
+		var  len = (String(base || 10).length - String(this).length)+1;
+		return len > 0? new Array(len).join(chr || '0')+this : this;
+	}*/
+
+
+	function table_download(data) {
+		var students=getSelectedStudents();
+		var csvContent = "data:text/csv;charset=utf-8,";
+		var head = ['Moodle_id', 'Prénom', 'Nom', 'Groupe', 'Complétion (en %)'];
+		data.active_section_id=$("#section-select").val();
+		for ( var m = 0; m < data.modules.length; m++ ) {
+			if ( data.active_section_id != data.modules[m].section && data.active_section_id != 0 ) {
+				continue;
+			}
+			head.push('"'+data.modules[m].displayname.replace(',', '')+'"');
+		}
+
+
+		csvContent += head.join(",");
+		csvContent += "\n";
+		
+		/* Pour chaque étudiant */
+		for ( var s = 0; s < data.students.length; s++ ) {
+			var arr_cpl = [];
+
+			/* Pour chaque activité du cours */
+			var activities_nbr = 0;
+			var done_activities_nbr = 0;
+			
+
+			for ( var mod = 0; mod < data.modules.length; mod++ ) {
+				/* Si le module n'est pas dans la section actuellement filtrée */
+				
+				if ( data.active_section_id != data.modules[mod].section && data.active_section_id != 0 ) {
+					continue;
+				}
+				
+
+				var stud_progress = data.students[s].progress
+				/* Si l'étudiant n'a pas de progres*/
+				if ( stud_progress.length == 0 ) {
+					arr_cpl.push(0);
+				} else {
+					// var prog = 0;
+					/* Pour chaque trace d'achèvement */
+					var cpl = 0;
+					for (var i =0; i<stud_progress.length; i++) {
+						
+						/* Quand l'index de progression correspond à l'id du module */
+						if ( data.modules[mod].id == stud_progress[i].idmodule ) {
+							cpl = stud_progress[i].completionstate;
+							if (cpl == 3) {
+								cpl = 0.5;
+								cpl = '"' + cpl.toLocaleString() + '"';
+							}
+						}
+					}
+					
+					if (cpl == 1 || cpl == 2) {
+						done_activities_nbr++;
+					}
+					arr_cpl.push(cpl);
+				}
+				activities_nbr++;
+			}
+			var perc = Math.round(100 * 100 * done_activities_nbr / activities_nbr) / 100;
+			var groups = '"';
+			active_group_id=$('#group-select').val();
+			data.active_group_name=$('#group-select').find('option:selected').html()
+
+			if ( data.active_group_name != "" && active_group_id != 0 ) {
+				groups += data.active_group_name.replace('"', '');
+			} else {
+				groups += data.students[s].groups.replace('"', '');
+			}
+			groups += '"';
+			var arr = [
+			data.students[s].id,
+			data.students[s].firstname,
+			data.students[s].lastname,
+			groups,
+			'"'+perc.toLocaleString()+'"',
+			arr_cpl
+			];
+			var dataString = arr.join(",");
+			csvContent += dataString + "\n";
+		}
+		
+		var encodedUri = encodeURI(csvContent);
+
+		var section_name = data.active_section_id;
+		if ( section_name == 0 ) {
+			section_name = "cours-complet";
+		} else {
+			section_name = slug_it($('#section-select').find('option:selected').html()).substring(0, 20);
+		}
+		var d = new Date;
+		month = d.getMonth()+1;
+
+
+		date = d.getFullYear() +"."+ padLeft(month) +"."+ padLeft(d.getDate()) +"-"+ padLeft(d.getHours()) +"."+ padLeft(d.getMinutes()) +"."+ padLeft(d.getSeconds());
+		
+		var link = document.createElement("a");
+		link.setAttribute("href", encodedUri);
+		link.setAttribute("download", "report-"+section_name+"-"+ date +".csv");
+		document.body.appendChild(link);
+		link.click();
+		document.body.removeChild(link); 
+	}
+
+});
diff --git a/amd/build/suivi.js b/amd/build/suivi.js
index 78c80bde8cbf57934835a301f991f31eb555c15e..8d2d788fe851631ff227b94f1d5946c8a880baa8 100644
--- a/amd/build/suivi.js
+++ b/amd/build/suivi.js
@@ -16,23 +16,17 @@
 /**
  * Handle add/remove competency links.
  *
- * @module     tool_lp/competencies
- * @package    tool_lp
- * @copyright  2015 Damyon Wiese <damyon@moodle.com>
+ * @module     format_iena/suivi
+ * @package    format_iena
+ * @copyright  2021 Myriam Delaruelle
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-define(['jquery'],
-       function($, ajax, templates, data) {
+define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
+       function($, ajax, templates, str) {
        	var all_selected=false;
-      
        	return{
-       		registerSelectAll:function(data){
-       			var datas=data;
-       			console.log(datas);
-       			$('#iena-select-all').on('click', function(e){
-	    		select_all_studs(e);
+       		registerSelectAll:function(){
 
-	    		});
 	    		$("#section-select").on('change', function(e){
 	    			changeFilter(e, 'section');
 	    		});
@@ -41,17 +35,11 @@ define(['jquery'],
 	    		});
 	    		
        		},
-       		registerSubmit:function(data){
-       			$("#id_submit_iena").on('click', function(e){
-	    		
-	    			triggerAction(e, data);
-	    		})
-       		}
+       		
        		
        	}
 
     function changeFilter(e, list){
-
     	url=window.location.search;
     	urlParams = new URLSearchParams(url);
     	courseid=urlParams.get('courseid');
@@ -70,206 +58,34 @@ define(['jquery'],
     	if(groupid){
     		completeUrl+="&groupid="+groupid;
     	}
-    	
+    	var loadingStudents = str.get_string('loadingResults', 'format_iena');
+    	$.when(loadingStudents).done(function(localizedEditString) {
+	         $("#partial-table").html("<div class='alert alert-primary' role='alert'>"+localizedEditString+"</div>");
+	    });	
 
     	$.ajax({ url: completeUrl,
          data: {action: 'test'},
          type: 'post',
          success: function(request) { 
-         	$("#partial-table").html(request);
+         	templates.render('format_iena/suivi-table', JSON.parse(request))
+         	.done(function(html, js){
+         		 $("#partial-table").html(html);
+         		 templates.runTemplateJS(js);
+         		 window.history.pushState('suivi',"", completeUrl);
+         	})
+	        .fail(function(){
+	        	var errorLoadingStudents = str.get_string('errorLoadingResults', 'format_iena');
+	        	$.when(errorLoadingStudents).done(function(localizedEditString) {
+			         $("#partial-table").html("<div class='alert alert-danger' role='alert'>"+localizedEditString+"</div>");
+			    });	
+	        });	
+           
          	
-         	window.history.pushState('suivi',"", completeUrl);
          	
 		}
 		});
     }
 
-    function select_all_studs(e) {
-		all_selected=!all_selected;
-		var counter = 0;
-		var checks = document.querySelectorAll("#table-body tr");
-		for (var i = 0; i < checks.length; i++) {
-			if ( checks[i].style.display != "none" || all_selected ) {
-				var box = checks[i].querySelector("input[type='checkbox']");
-				box.checked = all_selected;
-				counter++;
-			}
-		}
-	}
-
-
-	function getSelectedStudents(){
-		var selectedChecks=$("#table-body input:checked");
-		var students=[];
-		for(var i=0; i < selectedChecks.length; i++){
-			console.log(selectedChecks[i]);
-			students.push(selectedChecks[i].value);
-		}
-		console.log(students);
-		return students;
-
-	}
-
-
-	function triggerAction(e, data){
-		value=$("#select-actions-suivi-iena").val();
-		
-		if(value=="msg"){
-			console.log("on va envoyer un message");
-		}
-		else if(value=="download"){
-			table_download(data);
-		}
-	}
-
-
-	function slug_it(str) {
-		return str.toString().toLowerCase().trim()
-		.replace(/\s+/g, '-')           /* Replace spaces with - */
-		.replace(/&/g, '-and-')         /* Replace & with 'and' */
-		.replace(/[^\w\-]+/g, '')       /* Remove all non-word chars */
-		.replace(/\-\-+/g, '-');        /* Replace multiple - with single - */
-	}
-
-
-	function padLeft(date){
-		
-		return String(date).length > 1? date : '0'+date ;
-	}
-
-	/*Number.prototype.padLeft = function(base,chr){
-		var  len = (String(base || 10).length - String(this).length)+1;
-		return len > 0? new Array(len).join(chr || '0')+this : this;
-	}*/
-
-
-	function table_download(data) {
-		var students=getSelectedStudents();
-		var csvContent = "data:text/csv;charset=utf-8,";
-		var head = ['Moodle_id', 'Prénom', 'Nom', 'Groupe', 'Complétion (en %)'];
-
-		for ( var m = 0; m < data.modules.length; m++ ) {
-			if ( data.active_section_id != data.modules[m].section && data.active_section_id != 0 ) {
-				continue;
-			}
-			head.push('"'+data.modules[m].displayname.replace(',', '')+'"');
-		}
-
-
-		csvContent += head.join(",");
-		csvContent += "\n";
-		data.active_section_id=$("#section-select").val();
-		/* Pour chaque étudiant */
-		for ( var s = 0; s < data.students.length; s++ ) {
-			var arr_cpl = [];
-
-			/* Pour chaque activité du cours */
-			var activities_nbr = 0;
-			var done_activities_nbr = 0;
-			
-
-			for ( var mod = 0; mod < data.modules.length; mod++ ) {
-				/* Si le module n'est pas dans la section actuellement filtrée */
-				
-				console.log(data.modules[mod].section);
-				if ( data.active_section_id != data.modules[mod].section && data.active_section_id != 0 ) {
-					continue;
-				}
-				
-
-				var stud_progress = data.students[s].progress
-				/* Si l'étudiant n'a pas de progres*/
-				if ( stud_progress.length == 0 ) {
-					arr_cpl.push(0);
-				} else {
-					// var prog = 0;
-					/* Pour chaque trace d'achèvement */
-					var cpl = 0;
-					for (var i =0; i<stud_progress.length; i++) {
-						
-						/* Quand l'index de progression correspond à l'id du module */
-						if ( data.modules[mod].id == stud_progress[i].idmodule ) {
-							cpl = stud_progress[i].completionstate;
-							if (cpl == 3) {
-								cpl = 0.5;
-								cpl = '"' + cpl.toLocaleString() + '"';
-							}
-						}
-					}
-					
-					if (cpl == 1 || cpl == 2) {
-						done_activities_nbr++;
-					}
-					arr_cpl.push(cpl);
-				}
-				activities_nbr++;
-			}
-			
-			var perc = Math.round(100 * 100 * done_activities_nbr / activities_nbr) / 100;
-
-			// console.log(data.students[s]);
-			var groups = '"';
-			
-			
-			data.active_group_name=$('#group-select').find('option:selected').html()
-			console.log(data.active_group_name);
-			if ( data.active_group_name != "" ) {
-				groups += data.active_group_name.replace('"', '');
-			} else {
-				groups += data.students[s].groups.replace('"', '');
-			}
-			groups += '"';
-			var arr = [
-			data.students[s].id,
-			data.students[s].firstname,
-			data.students[s].lastname,
-			groups,
-			'"'+perc.toLocaleString()+'"',
-			arr_cpl
-			];
-			var dataString = arr.join(",");
-			csvContent += dataString + "\n";
-		}
-		
-		// stud_cpl.forEach(function(arr, index){
-		// 	var dataString = arr.join(",");
-		// 	csvContent += dataString + "\n";
-		// });
-		
-		var encodedUri = encodeURI(csvContent);
-
-		var section_name = data.active_section_id;
-		if ( section_name == 0 ) {
-			section_name = "cours-complet";
-		} else {
-			for (var i = 0; i < data.sections.length; i++) {
-				if ( data.sections[i].id == data.active_section_id ) {
-					section_name = slug_it(data.sections[i].name).substring(0, 20);
-				}
-			}
-		}
-		// var section_name = slug_it(this.active_section.section_name).substring(0, 10);
-		var d = new Date;
-		month = d.getMonth()+1;
-
-
-		//date = d.getFullYear() +"."+ month.padLeft() +"."+ d.getDate().padLeft() +"-"+ d.getHours().padLeft() +"."+ d.getMinutes().padLeft() +"."+ d.getSeconds().padLeft();
-		date = d.getFullYear() +"."+ padLeft(month) +"."+ padLeft(d.getDate()) +"-"+ padLeft(d.getHours()) +"."+ padLeft(d.getMinutes()) +"."+ padLeft(d.getSeconds());
-		//stringdate = d.getFullYear() +"."+ month +"."+ d.getDate().padLeft() +"-"+ d.getHours().padLeft() +"."+ d.getMinutes().padLeft() +"."+ d.getSeconds().padLeft();
-
-		var link = document.createElement("a");
-		link.setAttribute("href", encodedUri);
-		link.setAttribute("download", "report-"+section_name+"-"+ date +".csv");
-		document.body.appendChild(link);
-		link.click();
-		document.body.removeChild(link); 
-	}
-
-	
-
-
-	console.log("on passe par le js");
-	//registerSelectAll();
-
+   
   
 });
diff --git a/lang/en/format_iena.php b/lang/en/format_iena.php
index f4531142c4d89243145d6a29e235ce513e6c12fb..a3aaa2b744d4b4fc9e608a58861e53c04c813fe5 100644
--- a/lang/en/format_iena.php
+++ b/lang/en/format_iena.php
@@ -81,6 +81,8 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.';
 	$string['hide_section'] = 'HIDE section ';
 	$string['show_section'] = 'SHOW section ';
 	$string['aboutcourse'] = 'About this course';
-	
-	$string['modalite_help'] = 'Pour avoir de l\'aide sur les modalités';
+	$string['modalite_help'] = 'To get help on modalities';
+	$string['loadingResults'] = "Loading results...";
+	$string['errorLoadingResults'] = "Students could not be retrieved, please contact an administrator";
+
 
diff --git a/lang/fr/format_iena.php b/lang/fr/format_iena.php
index 2e0180734538c0be130e82a51e6adda3457642ff..d72dbde0301e6f93440b04a78a5194630445d98b 100644
--- a/lang/fr/format_iena.php
+++ b/lang/fr/format_iena.php
@@ -81,6 +81,6 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.';
 	$string['hide_section'] = 'CACHER la section ';
 	$string['show_section'] = 'MONTRER la section ';
 	$string['aboutcourse'] = 'À propos de ce cours';
-	$string['modalite'] = 'Modalité ?';
 	$string['modalite_help'] = 'Pour avoir de l\'aide sur les modalités';
-
+	$string['loadingResults'] = "Chargement des résultats...";
+	$string['errorLoadingResults'] = "Les étudiants n'ont pas pu être chargés, veuillez contacter un administrateur.";
diff --git a/suivi_unit.php b/suivi_unit.php
index 4c32eb9869242348ff901e235d6746f6174d80a6..d0b354e9608e4f74a00132e7de4fa60981326c0c 100644
--- a/suivi_unit.php
+++ b/suivi_unit.php
@@ -77,7 +77,7 @@ function get_groups($context, $active_group_id, $progress, $groups){
 		/* Récupération du nom du group actif au passage */
 		if ( $group->id == $active_group_id ) {
 			$active_group_name = $group->name;
-			
+
 			$group->selected='selected';
 		}
 		foreach ($current_user_groups_ids as $ugi) {
@@ -244,9 +244,15 @@ function set_data($data, $modules, $progress, $groups, $active_group_id){
 
 
 	$data["modules"]=$modules;
-
+	$count_modules=count($data["modules"]);
 
 	$data["students"]=format_progress($progress, $modules, $groups, $active_group_id);
+	$count_students=count($data["students"]);
+
+	if($count_students>0 && $count_modules>0){
+		$data['count_results']=count($data["students"]);
+	}
+	
 
 	if (has_capability('course/iena:suivi_edit', $context = context_course::instance($COURSE->id), $USER->id)) {
 		$data['link_bulkcompletion']= $CFG->wwwroot . "/course/bulkcompletion.php?id=" . $COURSE->id;
@@ -381,14 +387,15 @@ if ($_POST && !isset($_POST["action"])) {
 	$view = new view_send_message();
 	echo $view->get_content($usersID);
 } else if(isset($_POST['action']) && !empty($_POST['action'])) {
-	
-
+	//Si on change les filtres
 	$data=[];
 	$modules=get_activities($completion, $active_section_id);
 
 	$data=set_data($data, $modules, $progress, $groups, $active_group_id);
-	$renderer = $PAGE->get_renderer('format_iena');
-	$renderer->display_table_completion($data);
+	echo json_encode($data);
+	//$renderer = $PAGE->get_renderer('format_iena');
+
+	//$renderer->display_table_completion($data);
    	//echo json_encode($data);
 }
 else {
diff --git a/templates/suivi-table.mustache b/templates/suivi-table.mustache
index dff54abc51e16c6823b36da9343fc99301ae26ca..3a0da9938f52def5debec386e4dc260ce2e77890 100644
--- a/templates/suivi-table.mustache
+++ b/templates/suivi-table.mustache
@@ -1,7 +1,10 @@
-<table id="suivi">
+{{#count_results}}
+	<p>{{count_results}} résultat(s)</p>
+	<table id="suivi">
 	<thead>
 		<tr id="modules">
 			
+			
 			<th id="first-column-head"> <input type="checkbox" id="iena-select-all" >Etudiants</th>
 			{{#modules}}
 				<th class="th-rotate" data-fullname="{{name}}" data-section="{{section}}">
@@ -31,8 +34,12 @@
 	</tbody>
 </table>
 {{#js}}
-require(['format_iena/suivi'], function(module) {
-    module.registerSelectAll({{{ data }}});
+require(['format_iena/suivi-table', 'core/templates'], function(module) {
+    module.registerSelectAll();
     module.registerSubmit({{{ data }}});
 });
-{{/js}}
\ No newline at end of file
+{{/js}}
+{{/count_results}}
+{{^count_results}}
+	<p>Il n'y a pas de résultats correspondants aux filtres sélectionnés</p>
+{{/count_results}}
diff --git a/templates/suivi.mustache b/templates/suivi.mustache
index d9ea37fa485e11f9730a404bdcc131072b74b830..2f2c5ac8c1408d26b07d56333c39cb89548ba407 100644
--- a/templates/suivi.mustache
+++ b/templates/suivi.mustache
@@ -110,6 +110,12 @@
 
 <div id="partial-table">
 {{> format_iena/suivi-table }}
+{{#js}}
+require(['format_iena/suivi', 'core/templates'], function(module) {
+    module.registerSelectAll();
+   
+});
+{{/js}}
 </div>