Skip to main content

#Lightning Aura0 人がディスカッション中

2 件の回答
  1. 2021年11月6日 6:20

    Basically, The controller is the JS file that gets requests from the Component now the first thing we do is write most of the logic in the helper file and the Controller just calls the method defined in the helper the reason is it makes code look cleaner but the main reason is now since you have a method in helper file if you want to call it again then you can call it multiple times from controller method so any function that should act as a reusable function you should define it in helper. any function that we define in controller can only accept 3 parameters in the same order component, event, helper. so it can't contain a normal function that expects dynamic values as Parameter that you can only do in helper file 

0/9000

How to get  date time as per logged in user in Aura Lightning Component Table?

Issue I am facing is I am querying a list of data. When I am displaying that data in dataTable, datable is showing date time field based on machine this code is running, not on timeZone assigned to user in salesforce.

 

Please tell me what can i add to below code to get that

 

Current Code 

----------------

{label: 'Last Run Time', fieldName: 'lastrun', type: 'date', typeAttributes: {                                                                               day: 'numeric',                                                                               month: 'numeric',                                                                               year: 'numeric',                                                                               hour: '2-digit',                                                                               minute: '2-digit'             }}

 

#Trailhead Challenges

2 件の回答
0/9000

I am trying to align this table columns but the column border is not aligning uniformly in the table, can anyone please help me out what changes or approach need to be followed 

 

#Aura Component #Aura Lightning Components #Lightning Aura #Lightning Aura Component

How to align columns uniformly using html table

   

<table class="slds-table slds-table_bordered " style="width:100%;">

<thead>

<tr class="slds-text-heading_label" style="width:50%;">

<th scope="col" style="width:10%;text-align: center; border-right:1px solid #C2DBF1;z-index:0; border-top:1px solid #C2DBF1;" ><div class="slds-truncate" title="SO NAME">SO Name</div></th>

<th>

<th scope="col" style="width:10%;text-align: center; border-right:1px solid #C2DBF1; z-index:0; " ><div class="slds-truncate" title="TODAY PJP">Today PJP</div></th>

<th scope="col" style="width:10%;text-align: center; border-right:1px solid #C2DBF1; z-index:0; " ><div class="slds-truncate" title="STAUS">STATUS</div></th>

</th>

</tr>

</thead>

<tbody>

<aura:iteration items="{!v.visitRec}" var="item">

<tr style="width:50%;" >

<td style="word-wrap: break-word;white-space: normal;text-align: center; width:10%;z-index:0;background:#F8F8F8;border-right: 1px solid #C2DBF1; border-left: 1px solid #C2DBF1;">

<div data-id="{!item.soId}" onclick ="{!c.showMonthlyPJP}">

<a >{!item.soName}</a></div>

</td>

<td style="width:20%" colspan="2">

<aura:iteration items="{!item.todayPJP}" var="pjp">

<tr>

<aura:if isTrue="{!pjp.Beat__r.Name}">

<td style="text-align: center; width:10%;z-index:0;border-right: 1px solid #C2DBF1;"><lightning:formattedText value="{!pjp.Beat__r.Name}" /></td>

<td style="text-align: center; width:10%;z-index:0;"><lightning:input type="checkbox" disabled="true" checked="{!pjp.Visiting__c}" /></td>

<aura:set attribute="else">

<td style="text-align: center; width:10%;z-index:0;border-right: 1px solid #C2DBF1;"><lightning:formattedText value="{!item.noBeat}" /></td>

<td style="text-align: center; width:10%;z-index:0;"><lightning:input type="checkbox" disabled="true" checked="{!pjp.Visiting__c}" /></td>

</aura:set>

</aura:if>

</tr>

</aura:iteration>

</td>

</tr>

</aura:iteration>

</tbody>

</table>

3 件の回答
  1. 2021年9月21日 7:43

    There are two aura: iterations.

    Therefore, I think it is separated from the header.

    I think there is no choice but to fix it with pixel.

0/9000

Hi all,

 i am inserting single record with single attachment using lightning aura component.but how to insert single record with multiple files in single transaction.how i am achive this please let me know.

 

Please refer this link how i am make changes for multiple files.

http://sfdcmonkey.com/2017/09/25/file-upload-lightning-component/

1 件のコメント
  1. 2021年9月2日 8:07

    Hi @venkatesh j,

     

    you can set the "multiple" attribute to true in lightning:input type="file".

    Hope this is helpful :

    <lightning:input name="file1" type="file" label="Attachment"

    multiple="true" onchange="{!c.handleMultipleFiles}"/>

     

    handleMultipleFiles: function (component, event) {

    let files = event.getSource().get("v.files");

    console.log("all files : ", files);//contains the array of selected files

    alert(files.length + ' files !!'); //displays no. of files selected

    }

0/9000

I am using lightning:combobox seems like required doesn't work, can someone please help me with the code. How can I make this lightning:combobox field required by throwing some validation using client side controller in Lightning Aura

 

#Aura Component  #Aura  #Aura Lightning Components  #Lightning Aura  #Lightning Aura Component

4 件の回答
  1. 2021年9月2日 6:38

    When I pressed the submit button, I was launching handleChange2 with validity2 set to true on the parent component using this custom component.

     

    the custom component that includes lightning: combobox.

     

    cmp

    <aura:attribute name="validity2" type="Boolean" default="false"/> 

    <aura:handler name="change" value="{!v.validity2}" action="{!c.handleChange2}"/>

     

    controller

    handleChange2 : function(component, event, helper) {

            var inputCmp = component.find("required_ck");//Aura: id for lightning: combobox

            inputCmp.showHelpMessageIfInvalid();

     },

0/9000