Here is the code: Im checking if recruiter profile pic in undefined then pick it from hostCompany dataset and show in the jobrepeater: (im posting only relevant part of the code:)
the code is reading Title successfully but not showing profile pic, although console log is reading the file correctly:
defaultlogo wix:image://v1/489a2c8c728e4d4786747253c728fd65.jpg/Computer%20Sketch.jpg#originWidth=4725&originHeight=3700
Applicants
Line 49
-
$w( “#dbJobs” ).onReady(() => {
-
-
-
$w( "#repJobs" ).onItemReady( ($w, itemData, index) => {
-
-
if (itemData.createdBy.logo === undefined ) //company
-
{
-
$w( "#txtTemplogo" ).show();
-
-
wixData.query( "hostCompany" )
-
.eq( ‘title’ , “jobsandperks” )
-
.limit(2)
-
.find()
-
. then (results => {
-
let itemProfile = results.items[0];
-
console.log( 'defaultlogo' ,itemProfile.profilePic);
-
$w( "iptApplicantLogo" ).src = itemProfile.profilePic; $w("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ " ("+itemProfile.title+") no logo uploaded!!";
-
-
});
-
}
-
});
-
-
});
Wrong!
$w("iptApplicantLogo").src = itemProfile.profilePic;
Should work!
$item("iptApplicantLogo").src = itemProfile.profilePic;
Do not forget! —> You work in a REPEATER!
Every element which is INSIDE repeater —> $item
Every element which is OUTSIDE repeater —> $w
$w("#dbJobs").onReady(() => {
$w("#repJobs").onItemReady( ($item, itemData, index) => {
if (itemData.createdBy.logo === undefined) {
$item("#txtTemplogo").show();
wixData.query("hostCompany").eq('title', "jobsandperks")
.limit(2).find()
.then(results => {
let itemProfile = results.items[0];
console.log('defaultlogo',itemProfile.profilePic);
$item("iptApplicantLogo").src = itemProfile.profilePic;
$item("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ " ("+itemProfile.title+") no logo uploaded!!";
});
}
});
});
I as well tried changing the function:
$w( “#repJobs” ).forEachItem( ($item, itemData, index) => {
still not working .
Please use CODE-TAGS!
function userDefinedFields(){
$w("#dbJobs").onReady(() => {
filterJobs($w("#iptSearch").value, $w("#iptRegion").value, $w("#iptTownCity").value);
$w("#repJobs").onItemReady( ($item, itemData, index) => {
$item("#txtDesc").text = itemData.description.substring(0,140) + "...";
var options = { day:"numeric", month:"short", year:"numeric"};
var daysToGo = Math.round( ( itemData.closingDate - Date.now() ) / 1000 / 60 / 60 / 24);
$item("#txtClosingDate").text = "Closing date: " + itemData.closingDate.toLocaleDateString("en-GB", options) + " (" + daysToGo + " days to go)";
if (itemData.createdBy.logo === undefined) { xxx() }
function xxx (parameter) {
$item("#txtTemplogo").show();
wixData.query("hostCompany")
.eq('title', "jobsandperks")
.limit(2).find()
.then(results => {console.log(results)
let itemProfile = results.items[0];
let pic = itemProfile.profilePic
console.log('defaultlogo: ' + pic);
$item("iptApplicantLogo").src = pic;
$item("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ " ("+itemProfile.title+") no logo uploaded!!";
});
}
});
});
}
What does say the two green-marked console-logs?
here is the log:
data fetched from dataset hostCompany: [object Object]
Applicants
Line 48
defaultlogo: wix:image://v1/489a2c8c728e4d4786747253c728fd65.jpg/Computer%20Sketch.jpg#originWidth=4725&originHeight=3700
Applicants
Line 51
data fetched from dataset hostCompany: [object Object]
Applicants
Line 48
defaultlogo: wix:image://v1/489a2c8c728e4d4786747253c728fd65.jpg/Computer%20Sketch.jpg#originWidth=4725&originHeight=3700
Applicants
Line 51
if (itemData.createdBy.logo === undefined) //company
{
$item("#txtTemplogo").show();
wixData.query("hostCompany")
.eq('title', "jobsandperks")
.limit(2)
.find()
.then(results => {
console.log('data fetched from dataset hostCompany: '+ results)
let itemProfile = results.items[0];
let pic = itemProfile.profilePic
console.log('defaultlogo: ',pic);
$item("iptApplicantLogo").src = pic;
$item("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ " ("+itemProfile.title+") no logo uploaded!!";
//$item("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ ": no logo uploaded!!";
});
}
Perhaps this one, i am not sure, what is the issue here… 
function userDefinedFields(){
$w("#dbJobs").onReady(() => {
filterJobs($w("#iptSearch").value, $w("#iptRegion").value, $w("#iptTownCity").value);
$w("#repJobs").onItemReady(async($item, itemData, index) => {
$item("#txtDesc").text = itemData.description.substring(0,140) + "...";
var options = { day:"numeric", month:"short", year:"numeric"};
var daysToGo = Math.round( ( itemData.closingDate - Date.now() ) / 1000 / 60 / 60 / 24);
$item("#txtClosingDate").text = "Closing date: " + itemData.closingDate.toLocaleDateString("en-GB", options) + " (" + daysToGo + " days to go)";
if (itemData.createdBy.logo === undefined) {
$item("#txtTemplogo").show();
await wixData.query("hostCompany")
.eq('title', "jobsandperks")
.limit(2).find()
.then(async results => {console.log(results)
let itemProfile = results.items[0];
let pic = await itemProfile.profilePic
console.log('defaultlogo: ' + pic);
$item("iptApplicantLogo").src = pic;
$item("#txtTemplogo").text="Recruiter :"+itemData.createdBy.company+ " ("+itemProfile.title+") no logo uploaded!!";
});
}
});
});
}
did the changes…still not working.
well! np
thanx so much for your kind attention and all help.
if you have any pointers some other day…I’ll wait .
I can share my website with you…just so I have write idea…let me know and I can share to your account…it should be cake walk for you…
You can find me on my site (look onto my PROFILE).