function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Thomas D.Thomas D. 

lightning:datatable multiselect inline edit date / datetime not working

Hey,

I'm developing a lightning:datatable which supports the inline editing and multiselect functionality, however this doesn't seem to work with date or datetime.

Example:
My Datatable:
<lightning:datatable aura:id="relatedDataTable" columns="{!v.FieldList}" data="{!v.RecordsPage}"
                    keyField="Id" draftValues="{!v.draftValues}" onsave="{!c.handleSave}" oncancel="{!c.handleCancel}"
                    oncellchange="{!c.handleEdit}" sortedBy="{!v.sortedBy}" sortedDirection="{!v.sortedDirection}"
                    defaultSortDirection="{!v.defaultSortDirection}" onsort="{!c.updateColumnSorting}" onrowaction="{!c.handleRowAction}"
                    onrowselection="{!c.updateSelectedRow}" rowNumberOffset="{!v.rowOffset}" showRowNumberColumn="true" />
Example date column:
{fieldName:'Date__c', type:'date-local', label:'Date', sortable:true, editable:true}
The following happens:
The moment you try to check the "Update 3 selected items", the popup disappears and you are unable to set a date. It doesn't matter which order you try it. If you try to first set a date then check the checkbox the box disappears without posting the changes to the datatable. I have a feeling this has something to do with the way "focus" works on the date input. Even if you click right next to the date input, as soon as the input field loses focus, the box closes. the image below shows the scenario.

Does anybody know a solution to this? If this is a bug with the lightning:datatable, how do i notify Salesforce of this issue.
Lightning:datatable date multi edit



 
Raj VakatiRaj Vakati
. Inline editing is not supported for date and location fields.

Refer this link 

https://developer.salesforce.com/docs/component-library/bundle/lightning:datatable/documentation

When you make a column editable, a pencil icon appears when you hover over the cells in that column. Clicking the icon or pressing the Enter key triggers inline editing. Inline editing is not supported for date and location fields.
The datatable supports mass inline editing, so you can edit content in multiple table cells and save the changes in one step. The component verifies that you want to update multiple items before it applies your changes.
Thomas D.Thomas D.
Hey Raj,

I saw that in the documents aswell, However when you set the date column as editable= true. The pencil does appear. clicking the pencil icon does open the inline edit box and it will save whatever u inline edited there. So that documentation is probably either out of date or somebody made a mistake writing that.

Inline editing works, however multi inline editing with the checkboxes doesn't because the field loses focus and the box disappears.
Rahul Kumar DeyRahul Kumar Dey
Hey Thomas,

Yes you are correct Date type field is also editable for lightning-datatable, It's working fine in LWC. And I think the document is old one need to update...

Regards,
Rahul:)