Skip to main content
deleted 10 characters in body
Source Link
    <div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                        <lightning-datatable
                            key-field="Id"
                            data={data}
                            columns={columns}
                            onrowaction={handleRowAction}
                            hide-checkbox-column="true"
                            sorted-direction={sortDirection}
                            sorted-by={sortBy}
                            onsort={doSorting}
                            >
                        </lightning-datatable>
                    </div>
<div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                    <lightning-datatable
                        key-field="Id"
                        data={data}
                        columns={columns}
                        onrowaction={handleRowAction}
                        hide-checkbox-column="true"
                        sorted-direction={sortDirection}
                        sorted-by={sortBy}
                        onsort={doSorting}
                        >
                    </lightning-datatable>
                </div>
    <div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                        <lightning-datatable
                            key-field="Id"
                            data={data}
                            columns={columns}
                            onrowaction={handleRowAction}
                            hide-checkbox-column="true"
                            sorted-direction={sortDirection}
                            sorted-by={sortBy}
                            onsort={doSorting}
                            >
                        </lightning-datatable>
                    </div>
<div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                    <lightning-datatable
                        key-field="Id"
                        data={data}
                        columns={columns}
                        onrowaction={handleRowAction}
                        hide-checkbox-column="true"
                        sorted-direction={sortDirection}
                        sorted-by={sortBy}
                        onsort={doSorting}
                        >
                    </lightning-datatable>
                </div>
added 12 characters in body
Source Link
<div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                    <lightning-datatable
                        key-field="Id"
                        data={data}
                        columns={columns}
                        onrowaction={handleRowAction}
                        hide-checkbox-column="true"
                        sorted-direction={sortDirection}
                        sorted-by={sortBy}
                        onsort={doSorting}
                        >
                    </lightning-datatable>
                </div>
    <div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                        <lightning-datatable
                            key-field="Id"
                            data={data}
                            columns={columns}
                            onrowaction={handleRowAction}
                            hide-checkbox-column="true"
                            sorted-direction={sortDirection}
                            sorted-by={sortBy}
                            onsort={doSorting}
                            >
                        </lightning-datatable>
                    </div>
<div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                    <lightning-datatable
                        key-field="Id"
                        data={data}
                        columns={columns}
                        onrowaction={handleRowAction}
                        hide-checkbox-column="true"
                        sorted-direction={sortDirection}
                        sorted-by={sortBy}
                        onsort={doSorting}
                        >
                    </lightning-datatable>
                </div>
    <div class="slds-card__body slds-p-bottom_large" style="margin-top:-8px" >
                        <lightning-datatable
                            key-field="Id"
                            data={data}
                            columns={columns}
                            onrowaction={handleRowAction}
                            hide-checkbox-column="true"
                            sorted-direction={sortDirection}
                            sorted-by={sortBy}
                            onsort={doSorting}
                            >
                        </lightning-datatable>
                    </div>
added 8 characters in body
Source Link
const actions = [
    { label: 'Share with Client', name: 'share' },
];

const columns = [
    { 
        label: 'Title', 
        fieldName: 'docURL',
        type: 'url',
        typeAttributes: {label: { fieldName: 'Title' },
            target: '_blank'}, 
        initialWidth: 300,
        sortable: "true"
    },
    { label: 'Document Type', fieldName: 'DocType', sortable: "true"},
    { label: 'Date uploaded', fieldName: 'createdDate', type: 'date', sortable: "true" },
    { 
        label: 'Shared with client', 
        fieldName: '', 
        cellAttributes: { iconName: { fieldName: 'TransferStatus' },
        class: 'slds-align_absolute-center' },
        sortable: "true" 
    },
    { label: 'Date shared with client', fieldName: 'TransferedDate', type: 'date', sortable: "true" },
    { label: 'Uploaded by', fieldName: 'createdBy', sortable: "true" },
    {
        type: 'action',
        typeAttributes: { rowActions: actions, disabled: { fieldName: 'hideDocTransferButton' } },
    },
];

export default class DatatableWithRowActions extends LightningElement {
    @track data = [];
    @api recordId;
    columns = columns;
    record = {};
    @track sortBy;
    @track sortDirection;
   
    selectedRows=[];
    selectedData=[];
    cardTitle = 'Files'
    _wiredResult;
    loaded = false;
    
    
    @wire(getDocumentList, {recordId: '$recordId'} )
    wiredCallback(result) {
        this._wiredResult = result;
        if (result.data) {
            this.data = result.data;
            console.log('******this.data*****', JSON.parse(JSON.stringify(this.data)));
            this.loaded = true;
        } 
    }
    
    handleRowSelection(event) {
        let selectedRows = event.target.selectedRows;        
        this.selectedRows = selectedRows;
    }

    handleRowAction(event) {
        const actionName = event.detail.action.name;
        const row = event.detail.row;
        switch (actionName) {
            case 'share':
                this.handleTransAction(row);
                break;
            default:
        }
    }
}
    const actions = [
        { label: 'Share with Client', name: 'share' },
    ];
    
    const columns = [
        { 
            label: 'Title', 
            fieldName: 'docURL',
            type: 'url',
            typeAttributes: {label: { fieldName: 'Title' },
                target: '_blank'}, 
            initialWidth: 300,
            sortable: "true"
        },
        { label: 'Document Type', fieldName: 'DocType', sortable: "true"},
        { label: 'Date uploaded', fieldName: 'createdDate', type: 'date', sortable: "true" },
        { 
            label: 'Shared with client', 
            fieldName: '', 
            cellAttributes: { iconName: { fieldName: 'TransferStatus' },
            class: 'slds-align_absolute-center' },
            sortable: "true" 
        },
        { label: 'Date shared with client', fieldName: 'TransferedDate', type: 'date', sortable: "true" },
        { label: 'Uploaded by', fieldName: 'createdBy', sortable: "true" },
        {
            type: 'action',
            typeAttributes: { rowActions: actions, disabled: { fieldName: 'hideDocTransferButton' } },
        },
    ];

    export default class DatatableWithRowActions extends LightningElement {
        @track data = [];
        @api recordId;
        columns = columns;
        record = {};
        @track sortBy;
        @track sortDirection;
       
        selectedRows=[];
        selectedData=[];
        cardTitle = 'Files'
        _wiredResult;
        loaded = false;
        
        
        @wire(getDocumentList, {recordId: '$recordId'} )
        wiredCallback(result) {
            this._wiredResult = result;
            if (result.data) {
                this.data = result.data;
                console.log('******this.data*****', JSON.parse(JSON.stringify(this.data)));
                this.loaded = true;
            } 
        }
        
        handleRowSelection(event) {
            let selectedRows = event.target.selectedRows;        
            this.selectedRows = selectedRows;
        }
    
        handleRowAction(event) {
            const actionName = event.detail.action.name;
            const row = event.detail.row;
            switch (actionName) {
                case 'share':
                    this.handleTransAction(row);
                    break;
                default:
            }
        }
    }
const actions = [
    { label: 'Share with Client', name: 'share' },
];

const columns = [
    { 
        label: 'Title', 
        fieldName: 'docURL',
        type: 'url',
        typeAttributes: {label: { fieldName: 'Title' },
            target: '_blank'}, 
        initialWidth: 300,
        sortable: "true"
    },
    { label: 'Document Type', fieldName: 'DocType', sortable: "true"},
    { label: 'Date uploaded', fieldName: 'createdDate', type: 'date', sortable: "true" },
    { 
        label: 'Shared with client', 
        fieldName: '', 
        cellAttributes: { iconName: { fieldName: 'TransferStatus' },
        class: 'slds-align_absolute-center' },
        sortable: "true" 
    },
    { label: 'Date shared with client', fieldName: 'TransferedDate', type: 'date', sortable: "true" },
    { label: 'Uploaded by', fieldName: 'createdBy', sortable: "true" },
    {
        type: 'action',
        typeAttributes: { rowActions: actions, disabled: { fieldName: 'hideDocTransferButton' } },
    },
];

export default class DatatableWithRowActions extends LightningElement {
    @track data = [];
    @api recordId;
    columns = columns;
    record = {};
    @track sortBy;
    @track sortDirection;
   
    selectedRows=[];
    selectedData=[];
    cardTitle = 'Files'
    _wiredResult;
    loaded = false;
    
    
    @wire(getDocumentList, {recordId: '$recordId'} )
    wiredCallback(result) {
        this._wiredResult = result;
        if (result.data) {
            this.data = result.data;
            console.log('******this.data*****', JSON.parse(JSON.stringify(this.data)));
            this.loaded = true;
        } 
    }
    
    handleRowSelection(event) {
        let selectedRows = event.target.selectedRows;        
        this.selectedRows = selectedRows;
    }

    handleRowAction(event) {
        const actionName = event.detail.action.name;
        const row = event.detail.row;
        switch (actionName) {
            case 'share':
                this.handleTransAction(row);
                break;
            default:
        }
    }
}
    const actions = [
        { label: 'Share with Client', name: 'share' },
    ];
    
    const columns = [
        { 
            label: 'Title', 
            fieldName: 'docURL',
            type: 'url',
            typeAttributes: {label: { fieldName: 'Title' },
                target: '_blank'}, 
            initialWidth: 300,
            sortable: "true"
        },
        { label: 'Document Type', fieldName: 'DocType', sortable: "true"},
        { label: 'Date uploaded', fieldName: 'createdDate', type: 'date', sortable: "true" },
        { 
            label: 'Shared with client', 
            fieldName: '', 
            cellAttributes: { iconName: { fieldName: 'TransferStatus' },
            class: 'slds-align_absolute-center' },
            sortable: "true" 
        },
        { label: 'Date shared with client', fieldName: 'TransferedDate', type: 'date', sortable: "true" },
        { label: 'Uploaded by', fieldName: 'createdBy', sortable: "true" },
        {
            type: 'action',
            typeAttributes: { rowActions: actions, disabled: { fieldName: 'hideDocTransferButton' } },
        },
    ];

    export default class DatatableWithRowActions extends LightningElement {
        @track data = [];
        @api recordId;
        columns = columns;
        record = {};
        @track sortBy;
        @track sortDirection;
       
        selectedRows=[];
        selectedData=[];
        cardTitle = 'Files'
        _wiredResult;
        loaded = false;
        
        
        @wire(getDocumentList, {recordId: '$recordId'} )
        wiredCallback(result) {
            this._wiredResult = result;
            if (result.data) {
                this.data = result.data;
                console.log('******this.data*****', JSON.parse(JSON.stringify(this.data)));
                this.loaded = true;
            } 
        }
        
        handleRowSelection(event) {
            let selectedRows = event.target.selectedRows;        
            this.selectedRows = selectedRows;
        }
    
        handleRowAction(event) {
            const actionName = event.detail.action.name;
            const row = event.detail.row;
            switch (actionName) {
                case 'share':
                    this.handleTransAction(row);
                    break;
                default:
            }
        }
    }
Source Link
Loading