• Andreas Rikstad 5
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Hi all. I v\have a problem with my component.
I'm using lightning datatable with enabled in line editing to edit prices for products. Datatable definition looks like this:
<lightning:datatable
keyField="Id"
aura:id="table"
data="{!v.discountCodeItems}"
columns="{!v.columns}"
hideCheckboxColumn="true"
defaultSortDirection="asc"
draftValues="{!v.draftValues}"
oncellchange="{!c.handleCellChange}"
showRowNumberColumn="false"
isLoading="{!v.isLoading}"
wrapTextMaxLines="10"
onsave="{!c.handleSave}"/>
Columns definition:
component.set("v.columns",[
            {label : 'Product Name', fieldName : 'linkName', type : 'url',typeAttributes : {label : {fieldName : 'Name'}}},
            {label : 'Sales Price', fieldName : 'Sales_Price__c', type : 'currency', typeAttributes: { currencyCode: 'NOK'}, editable: true},
            {label : 'List Price', fieldName : 'List_Price__c',type : 'currency'},
            {label : 'Discount', fieldName : 'Discount', type : 'text'}
        ]);
I read changed value using:
var draftValues = event.getParam('draftValues');
and send it from component to Apex.
Te problem is when I change price from 24.00 to 24.89 JS controller sends:
[{"Sales_Price__c":"24.89","Id":"a699E000000Mc0JQAS"}]
but Apex receives
{Id=a699E000000Mc0JQAS, Sales_Price__c=2489.00}
If I change price back to 24 (without decimal part), Apex receives 24.
Do you know why it happens?
Hi all. I v\have a problem with my component.
I'm using lightning datatable with enabled in line editing to edit prices for products. Datatable definition looks like this:
<lightning:datatable
keyField="Id"
aura:id="table"
data="{!v.discountCodeItems}"
columns="{!v.columns}"
hideCheckboxColumn="true"
defaultSortDirection="asc"
draftValues="{!v.draftValues}"
oncellchange="{!c.handleCellChange}"
showRowNumberColumn="false"
isLoading="{!v.isLoading}"
wrapTextMaxLines="10"
onsave="{!c.handleSave}"/>
Columns definition:
component.set("v.columns",[
            {label : 'Product Name', fieldName : 'linkName', type : 'url',typeAttributes : {label : {fieldName : 'Name'}}},
            {label : 'Sales Price', fieldName : 'Sales_Price__c', type : 'currency', typeAttributes: { currencyCode: 'NOK'}, editable: true},
            {label : 'List Price', fieldName : 'List_Price__c',type : 'currency'},
            {label : 'Discount', fieldName : 'Discount', type : 'text'}
        ]);
I read changed value using:
var draftValues = event.getParam('draftValues');
and send it from component to Apex.
Te problem is when I change price from 24.00 to 24.89 JS controller sends:
[{"Sales_Price__c":"24.89","Id":"a699E000000Mc0JQAS"}]
but Apex receives
{Id=a699E000000Mc0JQAS, Sales_Price__c=2489.00}
If I change price back to 24 (without decimal part), Apex receives 24.
Do you know why it happens?