web/hdabo/static/hdabo/js/hdabo.js
changeset 9 ba16d97a8632
child 14 9de6715b6d84
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/hdabo/static/hdabo/js/hdabo.js	Mon Jun 06 11:54:28 2011 +0200
@@ -0,0 +1,33 @@
+function init_tags_events()
+{
+    // Up and down management for tag table lines
+    $(".up,.down").click(function(){
+        tag_up_down(this);
+    });
+}
+
+function tag_up_down(arrow)
+{
+    if ($(arrow).is(".up")) {
+        mv = "u";
+    } else {
+        mv = "d";
+    }
+    var url = tag_up_down_url;
+    var id_tag = $(arrow).attr('id');
+    $.ajax({
+        url: url,
+        type: 'POST',
+        data: {csrfmiddlewaretoken:global_csrf_token, 
+               datasheet_id:$('#datasheet_id').val(),
+               tag_id:id_tag,
+               move:mv
+               },
+        // bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType
+        //dataType: 'json',
+        success: function(msg, textStatus, XMLHttpRequest) {
+            $('#tag_table_container').html(msg);
+            init_tags_events();
+        }
+    });
+}
\ No newline at end of file