Is it possible to reorder the items displayed in a List Lookup control in Nintex Forms 2013? I tried using the "Source view" setting on the control to look at a specific View that uses a "display order" numeric column, but it didn't seem to affect display.
Is there a way to control the display order of a List Lookup control?
Thanks!
Jess
Solved! Go to Solution.
I used jQuery (NWF$) to accomplish what I needed.
Thanks,
Jess
Hi Jess,
I just tried using the "Source View" settings and it did work. I just tried following steps.
Please try if possible and let me know. This should be easier option to implement.
Thanks,
Shirin
Shirin,
I just made another small test case similar to the one you outlined, and you are correct, the Source view did work in setting the order according to the View on the lookup list. I will have to give this functionality another go.
Thanks!
Jess
Hi Jess,
Could you please share the JQuery script for sorting functionality. Thanks in advance!
Hi Shirin,
I'm unable to achieve using source view option, could you please advice me on this further.
Thanks
Arun
Hi Arun,
In this case I ended up only needing to reorder one item to the top of the list. I needed to move an option item with the Title value of “All Applications” to the top of the list of available options to choose from (What Nintex Forms calls the “Candidate” control).
To be able to reference the correct field in JavaScript, you need to go into the field control settings, click Advanced, and do the following:
Then within the settings of the Form itself, expand Custom JavaScript and add your logic for reordering. The logic I used to reorder the one option was the following. Note that to get ahold of the ‘Candidate’ control which contains the available options to choose from (on the left in the form display), I had to rebuild the ID to the HTML element. The ID given from the field control settings above gives you the ID of the HTML element that contains the options the user has chosen (on the right in the form display), NOT the list of options for them to choose from. That’s why you see me replacing the string in control ID from “Result” to “Candidate” below.
/*
Reorder "All Applications" in the <select> field
*/
// serviceControlId is set on the Control Element in the Nintex Form
NWF$(document).ready(function() {
var serviceControlCandidateId =
serviceControlId.replace("Result","Candidate");
var serviceControlCandidate = NWF$('#'+serviceControlCandidateId);
if(serviceControlCandidate.find('option[title="All Applications"]') != 'undefined'){
var optionAllApps = serviceControlCandidate.find('option[title="All Applications"]');
optionAllApps .insertBefore(serviceControlCandidate.find('option:eq(0)'));
optionAllApps .prop("selected",true);
serviceControlCandidate.find('option:eq(1)').prop("selected",false);
}
});
I hope this helps! Let me know if you have any questions…
Jess
Hi Jess / Shirin,
I was facing the same issue of List Lookup automatically sorting my master list items into ascending order. In my master list its already sorted based on the DisplayOrder field. I didn't wanted to create a new view for the solution which Shirin provided.
So, I tried passing the default view name ("All Items") to my Source view.
Hope this will be helpful for others!
Thanks,
Sukesh