Save and Copy - Ordering Question

By In-House-Logic - October 30, 2015

Hi there,

We have a client with a long list of products in a CMSB table. They often use the "Save and Copy" feature but are frustrated by the resulting record appearing as the last item on the product list (many pages away).

The list is ordered by dragSortOrder but has gone through some changes in recent weeks due to a previous sorting problem which has since been resolved.

Is there any way we can force the newly copied-n-created record to appear as the first item on the list? Or alongside the parent record?

Thanks,

J.

By gregThomas - November 6, 2015

Hey J. 

Thanks for sending me more details on the issue. The records were being ordered in ascending order in that section, instead of the default descending order. It's possible to make a small change to the plugin to get around this issue.

On line 43 of saveAndCopy.js.php, add the following code highlighted in green:

  $('#num').val('');
  $('#preSaveTempId').val( pseudoRandomNumber );
  $("input[name='dragSortOrder']").val( '0' );

  // Copy uploads from
  //alert("Debug: Copy uploads from " +recordNum+ " to " +pseudoRandomNumber );
  var copyUploadsUrl = '?_plugin=saveAsCopy&_pluginAction=copy&menu=' +escape

Let me know if you have any questions. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com