<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Efficy Overflow Q&amp;A - Recent questions tagged sortdelete</title>
<link>https://overflow.efficy.io/?qa=tag/sortdelete</link>
<description>Powered by Question2Answer</description>
<item>
<title>Customize SORTDELETE on DocuEdit</title>
<link>https://overflow.efficy.io/?qa=3559/customize-sortdelete-on-docuedit</link>
<description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;I am customizing the products grid on Docu Edit :&lt;br&gt;
DOCU&lt;em&gt;PROD have a 'F&lt;/em&gt;LOT' field that I use to set css classes and field definition in &lt;strong&gt;GridEditColumnsCustom.txt&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the screen below :&lt;br&gt;
- first two rows : &amp;lt; tr &amp;gt; element have the class 'simple' and F&lt;em&gt;LOT is NULL&lt;br&gt;
- the third line (grey) : &amp;lt; tr&amp;gt; element have the class 'lot' and K&lt;/em&gt;PRODUCT==F&lt;em&gt;LOT&lt;br&gt;
- other : &amp;lt; tr &amp;gt; element have the class 'detail' and F&lt;/em&gt;LOT is equal to the K_PRODUCT of the third row&lt;/p&gt;

&lt;p&gt;I want to customize the SORTDELETE definition :&lt;/p&gt;

&lt;p&gt;The delete button of the third line have to delete the 'others' lines. I do that in the workflow. In this example he have to delete 4 relations, but only 2 are deleted.. I think it is because the window is refreshed too quickly, &lt;strong&gt;where can I sleep the client script for 1s to let the WF do his job ?&lt;/strong&gt; (I have already the sleep function in Custom.js)&lt;/p&gt;

&lt;p&gt;Workflow function (called by OnDeleteDetailDocuProd) :&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function DeleteBatchDetails(EditHandle, Detail, K_LOT) {
  var docuProdDS = Database.GetDetailDataSet(EditHandle, ntProd);

  // filter which relations have to be deleted
  var Filter = 'F_LOT='+K_LOT+' AND F_LOT&amp;lt;&amp;gt;K_PRODUCT'; // current K_LOT relation will be remove by Efficy standard code
  var CleanFilter = decodeURIComponent(Filter).replace(/&amp;amp;#61;/gi, &quot;=&quot;).replace(/&amp;amp;lt;/gi, &quot;&amp;lt;&quot;).replace(/&amp;amp;gt;/gi, &quot;&amp;gt;&quot;)
  docuProdDS.Filtered = false
  if (CleanFilter != &quot;&quot;) {
    docuProdDS.Filter = CleanFilter
    docuProdDS.FilterOptions = 1
    docuProdDS.Filtered = true
  }

  if(docuProdDS &amp;amp;&amp;amp; !docuProdDS.IsEmpty) {
    Logger.Write('docuProdDS.recordCount='+docuProdDS.recordCount);
    var k_document = Database.GetEditKey(EditHandle);

    docuProdDS.First;
    while(!docuProdDS.EoF) {
      var k_product=docuProdDS.FieldByName('K_PRODUCT').AsFloat;
      var k_relation = docuProdDS.FieldByName('K_RELATION').AsFloat;

      Database.DeleteDetail(EditHandle, ntProd, k_product, k_relation);

      Logger.Write('docuProdDS.EoF='+docuProdDS.EoF);
      Logger.Write('Deleted DOCU_PROD ' + k_document + '-' + k_product + '('+k_relation+')');

      docuProdDS.Next;
    }
  }

  // unfilter dataset
  if (docuProdDS.Filter != &quot;&quot;) {
    docuProdDS.Filter='';
    docuProdDS.FilterOptions=0
    docuProdDS.Filtered=0
  }
}
&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Efficy/ Client side</category>
<guid isPermaLink="true">https://overflow.efficy.io/?qa=3559/customize-sortdelete-on-docuedit</guid>
<pubDate>Mon, 24 Sep 2018 09:48:11 +0000</pubDate>
</item>
</channel>
</rss>