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 } }}); } });
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.