Order List Lookup Values in Nintex Forms 2013?

  • 10 October 2014
  • 5 replies
  • 5 views

Badge +3

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


5 replies

Badge +3

I used jQuery (NWF$) to accomplish what I needed.

Thanks,

Jess

Badge +4

Hi Jess,

 

I just tried using the "Source View" settings and it did work. I just tried following steps.

  1. I created separate view for my source list which sort all the items based on price.
  2. I loaded Nintex Form and added List Lookup control and bind that control to use my list.
  3. In Source View section, I put newly created view name and publish form.

 

Please try if possible and let me know. This should be easier option to implement.

 

Thanks,

Shirin

Badge +3

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

Badge +3

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:

  • Check “Yes” on Store Client ID in JavaScript variable
  • In the field labeled Client ID JavaScript variable, provide a JavaScript variable name you plan to use to get the ID of the field control; In this case, I used: serviceControlID

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

Badge

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.

111752_pastedImage_2.png

Hope this will be helpful for others!

Thanks,

Sukesh

Reply