New answers tagged

0

I have checked your code and I found some minor mistakes in your code. That's why you are not getting the data. I have modified the code for you. ------------------------HTML----------------------------------- <template> <div class="slds-form-element"> <label class="slds-form-element__label"> <template if:...


0

SOLVED! In the following Javascript section... const casesColumns = [ {label: 'Case', fieldname: 'FSL_In_Jeopardy_Reason__c', type: 'text'}, {label: 'Owner', fieldname: 'OwnerName', type: 'text'}, {label: 'Call Id', fieldname: 'Call_Id__c', type: 'text'} ]; ...fieldname should be changed to fieldName, with a capital N.


1

Learning Resources You should review the LWC documentation, JS, and Trailhead, as others have already pointed out multiple issues with your code: Build LWC Trail in Trailhead LWC Developer Guide Single Selection LWC Lightning Datatable You'll want to filter out the newly selected rows of the table using a previous selected variable. In order to choose the ...


2

Your code has multiple issues. You're creating multiple lightning-data-tables, but then you only have a single preSelectedRows variable. You're assigning your slice to a local variable, not a variable bound to the table. Your slice method should use two parameters to get just the first entry (0,1). I haven't built your entire thing of code, but the ...


0

This question has already been answered for Aura components, however here's a solution for LWCs. You can bind a variable to draft-values like this: <lightning-datatable ... draft-values={draftValues} onsave={handleSave}> and in your JS, you need to set the variable to null on save, which will remove the save and cancel buttons: draftValues; handleSave(...


1

I have something already implemented like this as an example for your use case: <template if:true={contact}> <lightning-datatable key-field="Id" data={contact} onrowselection={handleRowSelection} columns={columns}> </lightning-datatable> </template> JS Code: import { LightningElement, wire } from 'lwc'; import ...


1

Add your Modal code here so I can see what is wrong, meanwhile here's how my Util Modal slot looks like : <div class="slds-modal__content modal-body scrollable slds-p-around_medium" id="modal-content-id-1"> <slot></slot> </div> and here's how I pass content to my modal from other LWC : <c-modal show-...


0

You need to handle the row action event on lightning-datatable. like <lightning-datatable key-field="id" data={data} columns={columns} onrowaction={handleRowAction} ...> As you have mentioned the name add in the typeAttributes of the button column, you can handle that action like below. handleRowAction(event) { if (event.detail.action....


2

It's a feature of the lightning-datatable. When you set a column to editable then row numbers are added and you can't remove them. Ref: By making a column editable, the show-row-number-column attribute is always true and the number column is displayed. Source here


1

radio is not a supported data type. You would need to make a custom data type, as written in the documentation under "Creating Custom Data Types".


1

As a single data table, no. There's no allowance for headers. But it could be written as a list of cards: <template for:each={sections} for:item="section"> <lightning-card key={section.id} icon-name="custom:custom11"> <h1 slot="title">{section.title}</h1> <lightning-datatable columns={...


1

For those looking for an easy reference of background colors / out of the box options, then as previously mentioned you can use the dynamic (row object specified) cellAttributes: { class: {fieldName: 'dataColumnOfClasses'} } or, if fixed for the entire table column, cellAttributes: { class: 'slds-icon-* '} } parameter when defining your columns. I compiled ...


0

You can do this in the data supplied to the datatable. You can specify two fields that supply data to the URL - a label and an href field. Like so: { label: '', fieldName: 'YOUR_LABEL_FIELD', type: 'url', 'iconName': 'utility:pdf_ext', initialWidth: 150, typeAttributes: { fieldName: 'YOUR_HREF_FIELD', label: 'Ver documento', target: '...


2

Unfortunately, this is not supported. The lightning-datatable is designed after SLDS, which does not have an allowance for multiple header rows or cells that span more than one column. You'd have to roll your own table instead.


2

My guess is that the table doesn't know to update because you have specified a key field of id but you have not provided on in the object array that you are feeding to the table. The table likely drives it's refresh algorithm off the key field, so even though you refreshed the array, with all the ids being the same, it won't rerender. And when you do it in ...


0

In short, you can't get the full html contents in because of Shadow DOM in LWC. To understand more about shadow dom, read here


2

You can extend datatable and setup event listeners that can then capture a row id. Our team followed this tutorial to get ours working with some minor modifications


Top 50 recent answers are included