CRM-16310 - Sortable table refinements
authorColeman Watts <coleman@civicrm.org>
Fri, 12 Jun 2015 21:51:11 +0000 (17:51 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 12 Jun 2015 21:51:11 +0000 (17:51 -0400)
templates/CRM/Custom/Page/Option.tpl

index 32a31ff1d7937184163f99ccd494685f170f81e6..befad67b41c57bb4da76d8f9e7cd29e1fb32742d 100644 (file)
@@ -99,8 +99,8 @@
                 var id = $('td:last', nRow).text().split(',')[0];
                 var cl = $('td:last', nRow).text().split(',')[1];
                 $(nRow).addClass(cl).attr({id: 'OptionValue-' + id});
-                $('td:eq(0)', nRow).wrapInner('<div class="crm-editable crmf-label" />');
-                $('td:eq(0)', nRow).prepend('<div style="cursor:move" class="icon ui-icon-grip-dotted-vertical">');
+                $('td:eq(0)', nRow).wrapInner('<div style="margin-left: 10px;" class="crm-editable crmf-label" />');
+                $('td:eq(0)', nRow).prepend('<div style="cursor:move; position: relative; left: -7px;" class="icon ui-icon-arrowthick-2-n-s" />');
                 $('td:eq(2)', nRow).addClass('crmf-default_value');
                 return nRow;
               },
         var gid = {/literal}'{$optionGroupID}'{literal};
 
         $("table.crm-option-selector tbody").sortable({
-          handle: ".ui-icon-grip-dotted-vertical",
+          handle: ".ui-icon-arrowthick-2-n-s",
           cursor: "move",
           start:function(event, ui) {
             var oSettings = $('table.crm-option-selector').dataTable().fnSettings();
             var index = oSettings._iDisplayStart;
             endPosition = index + ui.item.prevAll().length + 1;
 
-            $.getJSON(CRM.url('civicrm/ajax/reorder'), {
+            CRM.status({}, $.getJSON(CRM.url('civicrm/ajax/reorder'), {
               returnFormat:'JSON',
               start:startPosition,
               end: endPosition,
               gid: gid
-            })
+            }))
             .success(function() {
-              oSettings.oApi._fnDraw(oSettings);
-              CRM.status(ts('Saved'));
+              $("table.crm-option-selector tbody tr").each(function(i) {
+                $(this).removeClass('odd even').addClass(i % 2 ? 'even' : 'odd');
+              });
             });
           }
         });