Removal of close button from Select2 plugin
Requirement: The users who completed their tasks in selected Delivery PDVD must not be deleted from team allocation. Select2 plugin was used for selecting multiple users, which will have a cross button to remove the users. The cross button must be disabled for the users who completed their tasks in the selected Delivery PDVD Challenges faced: Select2 is an external plugin for selecting multiple values at a time. On default plugin don’t have any option to remove the close button. Solution: 1. Created a page level item to get all the completed users for selected Delivery PDVD. 2. Created a dynamic action with event as on Page load and called a JavaScript function. 3. Added JavaScript code in the page header to check the users from the previous page item and removed the close icon. function remove_close() { var a=$(“#P94_ROLE”).val(); //alert(a); if (a.length!=0) { var numbers = a.toString().split(‘,’); for(var i = 0; i < numbers.length; i++) { var b=numbers[i]; $(“ul.select2-choices li”).each(function(){ var s= $(this).text(); s=s.trim() if (s==b) { var z=$(this).find(“div”).next().removeClass(“select2-search-choice-close”); //alert(‘s = ‘+s); } …
Read More