Lookup Column | orderBy | not working

Hello,

Prior to the most recent update, I was able to sort the items in a Lookup field's drop-down using the following code:
fd.spRendered(function () {
fd.field('_MyLookup').ready().then(function () {
// sort lookup values
fd.field('_MyLookup').orderBy = { field: 'Title', desc: false };
});
});

However, this is no longer working.

Am I doing this in the wrong events?

Hello @ShareSquared,

Please try to add a refresh() to the code like this:


fd.spRendered(function () {
fd.field('_MyLookup').ready().then(function () {
// sort lookup values
fd.field('_MyLookup').orderBy = { field: 'Title', desc: false };
fd.field('_MyLookup').refresh();
});
});

That did it, thank you!

1 Like

@mnikitina Please please please can you make the default sorting by the lookup column rather than the ID? Or at least add it to the options of the lookup in the GUI as if you have a form with many lookups, add this is quite long :slight_smile:

Hello @Jamal_Smith-Graham,

That is a great idea!

Are you considering a paid support option?

We can add an "order by" option for the lookup field to the UI, so you can choose the sort field and sort type directly in the designer. If you are interested, please contact us by email: [email protected].