Skip to main content
Nintex Community Menu Bar
Question

drag and drop table reordering

  • Jul 10, 2024 4:06 PM UTC
  • 2 replies
  • 62 views
  • Translate All

Forum|alt.badge.img+3

Hi, I’m trying to figure out how I can reorder an entire list each time a list item is dropped into a new position. I’ve implemented something that almost works (works the first time you try and but not the second) and need some direction on what’s causing it to break on subsequent events. Here is the code: var params = arguments[0], $ = skuid.$, oldIndex, newIndex; var model = skuid.model.getModel(“Fabric”); var modelRows = model.getRows(); //Table->Display->Advanced->Unique id $(“#Skuid_Fabric_Trim tbody”).sortable({ start: function(event, ui) { oldIndex = ui.item.index(); }, stop: function(event, ui) { newIndex = ui.item.index(); for(i = 0; i < modelRows.length; i++){ if(i == newIndex) model.updateRow(modelRows[oldIndex], ‘Popularity__c’, newIndex); else model.updateRow(modelRows[i], ‘Popularity__c’, i); } //save the listed models var models = [model]; skuid.model.save(models,{callback:function(result){ if (result.totalsucess) { skuid.model.updateData(models); //requery model } }}); } });

This topic has been closed for replies.

2 replies

Forum|alt.badge.img+18

I just implemented a jQuery.sortable() solution which is working nicely: https://community.skuid.com/t/sort-table-with-drag-and-drop

Translate

Forum|alt.badge.img+8
  • Jul 10, 2024 4:24 PM UTC

Hi my table is inside a tab. So I cannot register the sortable on page load. I had to do it on models.loaded event…

Translate