I have queried a dataset on the backend (the reason is I needed to bypass permissions as my dataset is linked to PrivateMembersData). I store this result into “originalRows” which is accessible at the top of the page for all methods.
I then want to filter by a dropdown and using console I have found that the issue is in my if-statement of the filterResults() method. My code displays the original query on the repeater perfectly. I want to filter by “Position”. Here is my code:
function filterResults (){
let pos = $w ( ‘#positionDropdown’ ). value ;
console . log ( originalRows );
console . log ( “pos” );
console . log ( pos );
if ( pos && pos !== $w ( ‘#positionDropdown’ ). placeholder ) {
console . log ( “inside if statement” );
filteredRows = originalRows . filter ( item => item . position . _id === pos ); //THIS IS WHERE THE ISSUE LIES - I have even used item.position without "_id", Also not working.
}
console . log ( "res" );
console . log ( filteredRows ); //THIS RETURNS NOTHING
**return** filteredRows ;
}
I have another method that does the “onChange” of the dropdown to execute this above method. Why is the row in the if-statement not working? I am having syntax issues I think.