Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: Drag and Drop in UI5

$
0
0


Meanwhile we have a solution based on an example published, and hope that someone has the same problem can get some light :-)

 

  oDimension.addEventDelegate({

   onAfterRendering : function() {

    $("#lsDimension-listUl").sortable({

     connectWith : ".ui-sortable",

     start : function(event, ui) {

      // creates a temporary attribute on the element with the

      // old index

      $(this).attr('data-previndex', ui.item.index());

     },

     update : function(event, ui) {

      var newIndex = ui.item.index();

      var oldIndex = $(this).attr('data-previndex');

      $(this).removeAttr('data-previndex');

      oController.handleReorder(oldIndex, newIndex);

     }

    }).disableSelection();

   }

  });

 

Basically you have to use both the start and update events to retrieve the item positions before and after the DnD action. These indice can be used to reorder your list in the model. That is what we do with handleReorder() function in our controller.


Viewing all articles
Browse latest Browse all 9165

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>