You need to sign in to do that
Don't have an account?
Rasbehari Das
import styles from '@salesforce/resourceUrl/chartNew';
import { loadStyle } from 'lightning/platformResourceLoader';
export default class HelloWorld extends LightningElement {
renderedCallback() {
Promise.all([
loadStyle(this, styles + '/chart/datatable.css')
]).then(() => {
window.console.log('Files loaded.');
}).catch(error => {
window.console.log('Error ');
});
}
}
HelloWorldTest component
import { LightningElement, api, wire, track } from 'lwc';
export default class HelloWorldTest extends LightningElement {
}
How to destroy or dispatch renderCallback method.
I am importing one css file from staticresources folder, css file name is datatable.css this css file i am using for lightning-datatable in my HelloWorld component and it is working fine also css working fine as well. But if i run first HelloWorld component then HelloWorldTest component that time same css is reflecting in HelloWorldTest component. But i am not importing css file in the HelloWorldTest component. This css is not requred in the HelloWorldTest component.
Now my question is how to remove css or how to clear Cache memory before calling HelloWorldTest component.
HelloWorld component.
import { LightningElement, api, wire, track } from 'lwc';Now my question is how to remove css or how to clear Cache memory before calling HelloWorldTest component.
HelloWorld component.
import styles from '@salesforce/resourceUrl/chartNew';
import { loadStyle } from 'lightning/platformResourceLoader';
export default class HelloWorld extends LightningElement {
renderedCallback() {
Promise.all([
loadStyle(this, styles + '/chart/datatable.css')
]).then(() => {
window.console.log('Files loaded.');
}).catch(error => {
window.console.log('Error ');
});
}
}
HelloWorldTest component
import { LightningElement, api, wire, track } from 'lwc';
export default class HelloWorldTest extends LightningElement {
}
Check this blog,
https://salesforcediaries.com/2020/01/01/renderedcallback-in-lightning-web-component/
It might help you.