Skip to main content
Nintex Community Menu Bar

Are you as perplexed as me as to why the rules for forms and views are still not sorted alphabetically in the rules designer (see also Service Instance definitions when creating SmartObject methods), do you get fed up hunting for the rules constantly?

When you have the form / view open in the K2 designer, press F12 for the browser developer tools, paste the below code in to the console and hit return.

$('#pgRuleList').find('.toolbar-wrapper').append('<div class="toolbar-divider" id=""></div><a href="javascript:;" onclick="(function (){ const rules = Array.from(document.querySelectorAll(\'.input-control-group\')); rules.forEach(ul => { const rule = Array.from(ul.querySelectorAll(\'li\')); rule.sort((a, b) => { const textA = a.textContent.trim(); const textB = b.textContent.trim(); return textA.localeCompare(textB); }); ul.innerHTML = \'\'; rule.forEach(li => ul.appendChild(li));});})();" tabindex="0" class="toolbar-button filter" id="pgSortRules" title="Sort Rules"><span class="button-l"></span><span class="button-c"><span class="button-icon"></span><span class="button-text">Sort Rules</span></span><span class="button-r"></span></a>')

This will add a button to the Rules tab that will sort them for you when you press it.

 

Cheers

Can a mod add an m to ‘for’ in the title for me please - cheers.


Very good idea! Thank you for sharing this.


Reply