1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
<%-- // Permet de changer l'ordre d'affichage des artefacts --%>
$(".sortable tbody").sortable({
<%-- // Ce helper permet de conserver la taille des <td> lors du drag and drop. --%>
<%-- // Source : http://stackoverflow.com/questions/1569889/jquery-move-table-row --%>
helper: function(event, tableRow)
{
var $originals = tableRow.children();
var $helper = tableRow.clone();
$helper.children().each(function(index)
{
// Set helper cell sizes to match the original sizes
$(this).width($originals.eq(index).width())
});
return $helper;
},
update: onSourcePriorityChanged
}).disableSelection();
});
function onSourcePriorityChanged(event, ui) {
var test = $(this).parent().attr('id').trim();
if(test == "source")
{
var url = "/Diplome/Expertise/ModifierPrioriteAffichageSources";
var tableBody = $(ui.item).parent();
var tableRows = tableBody.children();
var noSources = new Array();
<%-- // Affiche l'avertissement de sauvegarde en cours --%>
var notification = tableBody.parent().next("div[id|=sauvegarde]");
notification.css("display", "block");
tableRows.each(function(index, row) {
var noSource = $(row).attr("id").substr("ligne-source-".length);
noSources.push(noSource);
});
$.ajax({
type: "POST",
url: url,
data: { noSources: noSources },
success: onSourcePriorityChanged_Success,
dataType: "json",
traditional: true
});
}
else
{
var url = "/Diplome/Expertise/ModifierPrioriteAffichageCompetences";
var tableBody = $(ui.item).parent();
var tableRows = tableBody.children();
var noCompetences= new Array();
<%-- // Affiche l'avertissement de sauvegarde en cours --%>
var notification = tableBody.parent().next("div[id|=sauvegarde]");
notification.css("display", "block");
tableRows.each(function(index, row) {
var noCompetence = $(row).attr("id").substr("ligne-competence-".length);
noCompetences.push(noCompetence);
});
$.ajax({
type: "POST",
url: url,
data: { noCompetences: noCompetences },
success: onCompetencePriorityChanged_Success,
dataType: "json",
traditional: true
});
}
} |
Partager