All rows from dataset are displayed in table, query has no effect

All rows from dataset is getting displayed even though I have code to show only few rows using my code. I like to show data only applicable to logged user from a dataset using: wixData.query(“members”).eq(“memberId”, wixUsers.currentUser.id)..)
I see code running fine with no error/exception. But all rows from the dataset is getting displayed in the table.
How do I fix it? Thanks

Code:
import wixData from ‘wix-data’;
import wixUsers from ‘wix-users’;
import wixLocation from’wix-location’;

let rowIndex = 0;
let rowData =0;

$w.onReady(function () {

console.log(“Load Table”);

let firstItem;

wixData.query(“members”).eq(“memberId”, wixUsers.currentUser.id)
.find()
.then( (results) => {
let items = results.items;
let totalCount = results.totalCount;

let rows = $w("#table1").rows; 

let tabInd = 0; 
let lstNm = ""; 
for (var i = 0; i < totalCount; i++) { 
    firstItem = items[i]; 
    console.log(firstItem['memberId'] + ' == ' + wixUsers.currentUser.id + " - " + firstItem['firstName']) 
    if (tabInd < rows.length){    

		if(firstItem['title'] !== null && firstItem['title'] !== '') 
		{          
        	rows[tabInd]["name"] =  firstItem['title'];  
			$w("#lstNmText").text = "Family Lastname: " + firstItem['title']; 
			lstNm = firstItem['title']       
		} 
		if(firstItem['title'] !== null && firstItem['title'] !== '' && firstItem['title'] !== lstNm) 
		{ 
			rows[tabInd]["name"] =  firstItem['firstName'] + " " + firstItem['title'] ; 
			
		}  
		else{  
        	rows[tabInd]["name"] =  firstItem['firstName']; 
		} 
		rows[tabInd]["nakshthra"] =  firstItem['nakshthra']; 
		rows[tabInd]["rasi"] =  firstItem['rasi']; 
		if(firstItem['gothra'] !== null && firstItem['gothra'] !== '' && firstItem['gothra'] !== undefined) 
		{ 
			$w("#gothraTxt").text = "Family Gothra: " + firstItem['gothra']; 
			$w('#Gothra').text = "Add new member"; 
			$w('#gotInp').hide(); 
		} 
		
		
        tabInd++; 
    } 

 } 
 
$w("#table1").rows = rows; 

$w("#table1").show('FadeIn'); 

console.log("Done with load method"); 

} )
.catch( (err) => {
console.error(err);
} );

});

Jay, it appears that you are attempting to use both a dataset and wixData.query together to obtain the result to show in the table. It’s a common thing people new to Velo tend to do. You really have to decide on which approach to use: a dataset or wixData.query for any page where you have a table or repeater. They don’t play well with each other. Given the after-query altering of the data you are doing, wixData.query is the only choice that you have.

The first thing to do is to disconnect the dataset from the table and depend on the query results, which are already filtered on the member.

I would remove the following line and make the for loop changes to the items array instead:

let rows = $w("#table1").rows;

Then assign the modified items array to the table after the for loop.

$w("#table1").rows = items;

Thanks. it is working after disconnecting to dataset.