Lookup fields within a table

Hi,

I have a large form linked to a sharepoint list. A section of my form contains a table for uploading documents into a sharepoint library. One of the columns in the library is a lookup field (calculated). I usually just use JS to filter calculated lookups in list items to make them searchable and ordered A-Z. I'm not sure how to do this within the table though as nothing I have tried seems to work. I need it so that when a person uploads a document, and clicks on the lookup name field, they can start typing and the list will filter options

The below works for lookup fields in my list:

fd.spRendered(function() {
fd.field('Instructor_x0020_Name').filter = function(filter) {
    var search = encodeURIComponent(filter);
    return filter
        ? "substringof('" + search + "', Surname) or substringof('" + search + "', Title)"
        : '';
}
fd.field('Surname').useCustomFilterOnly = true;
});

How do I do this with a table (SPDataTable5)?
Thanks

Dear @traveller,
Check out the following option to customize filter for a Lookup field in List or Library - Manipulate fields in inline editing mode of List or Library — SharePoint forms

Hi,
Thanks @Nikita_Kurguzov.
I've had a look at that page but I didn't really need something as functional. Is there no simple js query to sort the order and facilitate a search in just the one lookup column of the library table in the same way I can query the order/search of a list item lookup in form?

Thanks :slight_smile:

Dear @traveller,
What do you mean? Just replace the filter in the example with your own filter and it should work:

fd.spRendered(function() {
    fd.control('SPDataTable1').$on('edit', function(editData) {
        editData.field('LookupColumn').filter = function(filter) {
          var search = encodeURIComponent(filter);
          return filter ? "substringof('" + search + "', Surname) or substringof('" + search + "', Title)" : '';
        }
        editData.field('LookupColumn').useCustomFilterOnly = true;
    });
});

Many thanks - that's working for me now :slight_smile: