Skip to content

Instantly share code, notes, and snippets.

@svierk
Last active January 3, 2024 08:17
Show Gist options
  • Save svierk/6b3f94a7781b897f408f31c9f806d37c to your computer and use it in GitHub Desktop.
Save svierk/6b3f94a7781b897f408f31c9f806d37c to your computer and use it in GitHub Desktop.
JS Code for Drag & Drop Demo LWC | Variables & connectedCallback
import { LightningElement, track } from 'lwc';
const COLUMNS = [
{
label: 'Id',
fieldName: 'id',
hideDefaultActions: true
},
{
label: 'Label',
fieldName: 'label',
hideDefaultActions: true
}
];
export default class DragAndDrop extends LightningElement {
elements = [];
columns = COLUMNS;
@track data = [];
connectedCallback() {
for (let i = 1; i <= 12; i++) {
this.elements.push({ id: i, label: `Element ${i}` });
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment