List Or Library - Get Values

Hello,

I have List or library component in my Plumsail form which is connected to another sharepoint list.
In Javascript editor i have code that filter my List or library. Is there any way to get filtered values from it?
List or library have three columns - Title, Name, Country.

Here is my code so far:

fd.control('ListOrLibrary').ready(function() {
var listOrLibrary = fd.control('ListOrLibrary');
listOrLibrary.filter = '1117';
listOrLibrary.refresh();
});

Thank you

Hi @Marek,

I think the simplest way to achieve this is to get all items from List or Library and sort them with JavaScript like so:

let items = listOrLibrary._widget.dataItems(); // get the items from List or Library
let filteredItems = [];

for (let i = 0; i < items.length; i++) {
    if (items[i].Title == "Required title") filteredItems.push(items[i]); // sort the items, change the condition to fit your needs
}
        
for (let i = 0; i < filteredItems.length; i++) {
    console.log(filteredItems[i].ID);
    console.log(filteredItems[i].Title);
    console.log(filteredItems[i].Name);
    console.log(filteredItems[i].Country);
}

Hi,

Thank you, it is working perfect.
I was using _widget._data, but it was not working as i want.

Thanks, Marek