Dynamic Search in Lightning WebComponent

preview_player
Показать описание
Dynamic Search in Lightning WebComponent
Рекомендации по теме
Комментарии
Автор

import { LightningElement, wire, track } from 'lwc';

export default class firstcmp extends LightningElement {
@track conLastName;
@track contacts;
@track error;

@wire(displayConRecords, {'$conLastName'}, fields: [CONTACT_NAME_FIELD])
wiredContacts({ error, data }) {
if (data) {
this.contacts = data;
this.error = undefined;
} else if (error) {
this.error = error;
this.contacts = undefined;
}
}
handleChange(event){
this.conLastName = event.target.value;
}
}

Rama-uksq
Автор

import { LightningElement, track, wire, api } from 'lwc';

export default class Firstcmp extends LightningElement {
@api conLastName;
@track records;
@track error;
@api recordId;

@wire (displayConRecords, {searchkey:'$conLastName'})
wireRecord({data, error})
{
if(data){

}
else if(error){
this.error=error;
this.records=undefined;
}
}
handleChange(event){
this.conLastName =event.target.value;

}



}

Rama-uksq
Автор

your partial code is discouraging me, i am struggling more than 2 days/

Rama-uksq
Автор

import { LightningElement, track, wire, api } from 'lwc';

export default class Firstcmp extends LightningElement {
@api conLastName;
@track records;
@track error;
@api recordId;

@wire (displayConRecords, {searchkey:'$conLastName'})
wireContacts({data, error})
{
if(data){
this.records=data;
this.error=undefined;
}
else if(error){
this.error=error;
this.records=undefined;
}
};

handleChange(event){
this.conLastName =event.target.value;

}

}

Rama-uksq