Open vijayk3327 opened 1 year ago
In this post we are going to learn about Search between two dates get the all records start date and end date using search functionallty In LWC.
When a user clicks into the global search bar they will see their recent items. As they start typing in the search box, they will be shown recent items that match their search criteria. If the correct record is displayed.
→ Get source code live demo link:-
Step 1:- Create Lightning Web Component : lwcSearchDate.html
`
Step 2:- Create Lightning Web Component : lwcSearchDate.js ` import { LightningElement,track } from 'lwc'; import searchRoItem from '@salesforce/apex/lwcDateCmpCtrl.searchRoItem'; import { NavigationMixin } from 'lightning/navigation'; export default class LwcSearchDate extends NavigationMixin(LightningElement){ @track firstName; @track lastName; @track oldDate; @track oldDate2; @track newDate; @track newDate2; @track dateRecoreId; @track errorMsg; @track roDateList; @track recordId;
handleChangeAction(event){ if(event.target.name == 'oldDate'){ this.oldDate = event.target.value; window.console.log('oldDate ##' + this.oldDate); } if(event.target.name == 'oldDate2'){ this.oldDate2 = event.target.value; window.console.log('oldDate2 ##' + this.oldDate2); } } searchAction(){ searchRoItem({dateStr1:this.oldDate,dateStr2:this.oldDate2}) .then(result=>{ this.dateRecoreId = result.Id; this.roDateList=result; //window.console.log('dateRecoreId##Vijay2 ' + this.dateRecoreId); window.console.log('roDateList ' + JSON.stringify(this.roDateList)); }) .catch(error =>{ this.errorMsg=error.message; window.console.log(this.error); }); } actionToPublishedNav(event) { this.recordId=event.target.name; window.console.log('logAAA ' + this.recordId + 'LogBBB ' + event.target.name); this[NavigationMixin.Navigate]({ type: 'standard__recordPage', attributes: { recordId: this.recordId, objectApiName: 'Account', actionName: 'view' }, }); }
}`
Step 3:- Create Lightning Web Component : lwcSearchDate.js-meta.xml
` <?xml version="1.0" encoding="UTF-8"?>
In this post we are going to learn about Search between two dates get the all records start date and end date using search functionallty In LWC.
When a user clicks into the global search bar they will see their recent items. As they start typing in the search box, they will be shown recent items that match their search criteria. If the correct record is displayed.
→ Get source code live demo link:-
Step 1:- Create Lightning Web Component : lwcSearchDate.html
`
`
Step 2:- Create Lightning Web Component : lwcSearchDate.js ` import { LightningElement,track } from 'lwc'; import searchRoItem from '@salesforce/apex/lwcDateCmpCtrl.searchRoItem'; import { NavigationMixin } from 'lightning/navigation'; export default class LwcSearchDate extends NavigationMixin(LightningElement){ @track firstName; @track lastName; @track oldDate; @track oldDate2; @track newDate; @track newDate2; @track dateRecoreId; @track errorMsg; @track roDateList; @track recordId;
}`
Step 3:- Create Lightning Web Component : lwcSearchDate.js-meta.xml
` <?xml version="1.0" encoding="UTF-8"?>