123
chenjingwu
2024-04-11 1a1303f4f3c933dcfb67df7f1f630159e6ee0740
force-app/main/default/lwc/lexLookupLwc/lexLookupLwc.js
@@ -4,7 +4,7 @@
 * @Author: chen jing wu
 * @Date: 2023-05-25 13:59:44
 * @LastEditors: chen jing wu
 * @LastEditTime: 2023-08-01 15:34:21
 * @LastEditTime: 2023-09-27 15:30:05
 */
import { LightningElement, track, api } from 'lwc';
import getRecordsByName from '@salesforce/apex/lexLookupController.getRecordsByName'
@@ -43,11 +43,14 @@
        
    }
    connectedCallback(){
        if(this.initValue != '' && this.initValue != undefined && this.initValue != null){
            this.recordselected = true;
            this.selectedValue = this.initValue;
        }
    }
    @api
    letDisabledTrue(){
        this.recordselected = false;
@@ -65,9 +68,18 @@
    //Method to clear search list and show selected value.
    @api
    clearSelection() {
        console.log('qwer');
        this.recordselected = false;
        this.selectedValue = "";
        this.recordsList = undefined;
        const customEvent = new CustomEvent('buttonclick', {
            bubbles: true,  // 使事件冒泡
            composed: true  // 使事件可以跨shadow boundary传播
        });
        this.dispatchEvent(customEvent);
    }
    dontClose(event){
        event.preventDefault();
    }
    //Method to pass selected record to parent component.
@@ -85,4 +97,7 @@
        });
        this.dispatchEvent(selectedEvent);
    }
    clear(){
        this.recordsList = undefined;
    }
}