New answers tagged

0

Below code is working fine for onrowselection event of datatable. This might be helpfull for your requirements too. Please give it a try. HTML : <!--Custom button --> <lightning-button variant="neutral" label="Save" title="Save" onclick={handleSave} class="slds-m-left_x-small"> </...


0

There is no direct work for this requirement, But you can use my colleague's custom code (specially designed for datatable). This works fine with me. Code may little big but its worth using as it will work dynamically. You just need to pass list for fields apis and it will detect which field is lookup and will fetch name value for the lookup. Mark it as best ...


1

It doesn't look like lightning-datatable (actually lightning-formatted-url, which it uses) directly supports other protocols besides http or https. This is probably to prevent Cross-Site Scripting (XSS) vulnerabilities. Even the mailto protocol appears to be unsupported. You can specify a relative URL using /, ./, etc. See documentation for lightning-...


0

according to the https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.reactivity_fields reactivity is ignored since it doesn’t impact the rendered content workaround: getColumns(visible) { return { courtesyId: { label: 'courtesyId', fieldName: 'courtesyId', order: 1, ...


1

event.detail.row isn't an Array, it's a single object. You may have meant: this.finalSObjectDataListChild = [dataRow]; Which would make it suitable for lightning-datatable.


1

As per @SachinHooda's suggestion in comment, Replaced lwc combobox with with and that fixed the issue. <div class="slds-select_container" > <select name="peGroup" value={selectedId} class="slds-select" onchange={handleChange}> <template for:each={options} for:item="opt"> ...


2

Define the class level attribute to store the columns, columns. From the wired method add the dynamic columns to that. export default class MyComponent extends LightningElement { @track columns = [ { label: 'View', type: 'button-icon', initialWidth: 75, typeAttributes: { iconName: '...


0

Lightning data-table easily helps us to show large data in tabular format, with a flexible selection approach. When pagination applies with the LWC: Datatable pre-selected-rows, it does not work straightforward way. Because apply pagination helps to display only selected page information and hide the rest of the records actually they are not populated yet. ...


1

You can do this in your sorting algorithm: let keyValue = (record) => { let value = record[fieldName] return typeof value == 'string'? value.toUpperCase(): value } If the value is a string, we'll return the uppercased string, otherwise we return the value directly, as in the original code.


1

Not a solution but I can say with 99% certainty is that you can’t do this without some crazy JS and CSS. I would personally avoid that and accept the fact that the buttons are at the bottom and focus on the things that I can change.


1

Implement a custom data type with your html executing modal on click Recently a new feature was released which allows to define custom data types in standard lightning:datatable component. Create a LWC component customTable with the following JS import LightningDatatable from 'lightning/datatable'; import clickModal from './clickModal.html'; export default ...


0

You need to tweak your code a bit, to make columns a JS getter instead of a constant. Inside the getter you can then assign the disableButtons property to the disabled attribute. export default class Demo extends LightningElement { disableButtons = false; get columns(){ return [ { label: 'Name', fieldName: 'Name', type: 'text' },...


0

Workaround: Use type button and style it like text. Here's a working example. Basically, when setting your data, you'll set the column type as 'button', and add a class - in this example, I'm calling the class 'text-button', and this is for an Address field: { label: 'Address', fieldName: 'address', type: 'button', typeAttributes: { ...


0

You need to expose on child component an api method which will contain the querySelector method and will return the selected rows to parent component. This trailhead might be useful to you. child @api getRows() { return this.template.querySelector("lightning-datatable") .getSelectedRows(); } then in your parent you can call this method ...


Top 50 recent answers are included