Posts

Showing posts from February, 2020

Multiple Checkboxex with default as true

toggle_smle_app.app <aura:application extends="force:slds">     <aura:attribute name="allaccounts" type="List" default="[ { BillingCity: 'Denver' }, { BillingCity: 'Ontario' }, { BillingCity: 'San Francisco' } ]" />     <aura:attribute name="selectedCities" type="List" default="[]" />     <aura:iteration var="a" items="{!v.allaccounts}" indexVar="indx">         <ui:inputCheckbox aura:id="checkbox"                           value="true" text="{!a.BillingCity}"                           name="{!indx}"                           label="{!a.BillingCity}"                           change="{!c.selectoptionvalue}"/>     </aura:iterat...

Onclick of button iterate and display map from server to client side controller

Aura Class public class SampleAuraController {   @AuraEnabled     Public static Map<string, List<string>> getMap(){         Map<String, List<string>> mapObj = new Map<String, List<string>>();         List<string> fruits = new List<String>{'Apple', 'Orange', 'Banana', 'Grapes'};         List<string> vegetables = new List<String>{'Cabbage', 'Carrot', 'Potato', 'Tomato'};         mapObj.put('Fruits', fruits);         mapObj.put('Vegetables', vegetables);         return mapObj;     } } c:SampleAuraController <aura:component controller="SampleAuraController">     <aura:attribute name="mapValues" type="object" />     <div class="slds-m-around_xx-large">         <div class="slds-box slds-theme_default"> ...

Onclick of button through iteration shows index

test_a.app <aura:application extends="force:slds">    <ul>         <aura:iteration items="[a1,a2,a3,a4]" var="product" indexVar="index">             <li onclick="{!c.ShowDataOnClick}" data-row-index="{!index}">                 <p>{!product}</p>                           </li>         </aura:iteration>     </ul> </aura:application> ({         ShowDataOnClick: function(component, event, helper) {            var index = event.currentTarget.dataset.rowIndex;             console.log(index);             console.log(event.currentTarget.dataset.rowIndex);         }     }) O/p [a1...

Attributes

Label Hidden Used to hide the label                    <lightning:input type="number" label="number" variant = "label-hidden" name="aNumberInputField"/> <aura:component >     <lightning:recordEditForm objectApiName="Account">         <lightning:messages />             <div class="slds-grid">                <div>                 <div class="slds-col slds-size_1-of-3">                    <lightning:input type="number" label="number" variant = "label-hidden" name="aNumberInputField"/>                 </div>                <div class="slds-col slds-size_1-of-3">           ...

Schema-Parent,Child,Formula

Schema.DescribeSObjectResult R = Account.SObjectType.getDescribe(); for (Schema.ChildRelationship cr: R.getChildRelationships()) { system.debug('====child object==='+cr.getChildSObject()); } for(Schema.SobjectField strFld: Contact.SobjectType.getDescribe().fields.getMap().Values()){ if(strFld.getDescribe().getType() == Schema.DisplayType.REFERENCE){ system.debug('==parent object='+strFld.getDescribe().getReferenceTo()); } } String strFormula = ''; String strTable = '<table><th>Field Name</th><th>Formula</th>'; //replace with appropriate object name Map<String, Schema.SObjectField> fieldMap = Schema.SObjectType.Car_Service__c.fields.getMap(); for(Schema.SObjectField field : fieldMap.values()){     Schema.DescribeFieldResult dfr = field.getDescribe();     //isCalculated() is used to identify custom formula fields     //getCalculatedFormula() != null is used to exclude rollup summary fields as they are ...

Using Wire Apex

Using Wire Apex Scenario 1: Using Wire Apex: AccountCountroller.html <template>      <lightning-card title= 'Account' >          <ul>          <lightning-card title= "Account List" >              <div class= "slds-m-around_medium" >                  <template if:true= {accounts.data} >                      <template for:each= {accounts.data}  for:item= "acc" >                          <p key= {acc.Id} > {acc.Name} ...

Toggle

Image
ToggleButton.cmp <aura:component >     <aura:attribute name="box1" type="Boolean" default="true" />     <aura:attribute name="box2" type="Boolean" default="true" />       <aura:handler name="change" value="{!v.box1}" action="{!c.logChange1}" />     <aura:handler name="change" value="{!v.box2}" action="{!c.logChange2}" />       <ui:inputCheckbox value="{!v.box1}" label="The Box To Check" />     <lightning:input name="box2" type="toggle" checked="{!v.box2}" label="The Other Box To Check" />   </aura:component>  ToggleButtonController.js ({ logChange1: function(component, event, helper) {     console.log(component.get("v.box1")); }, logChange2: function(component, event, helper) {     console.log(component.get("v.box2")...

LWC Scenario

Image
O/P Data Table Component   <template>      <lightning-card title =  "Search Accounts"  icon-name =  "custom:custom63" >                    <div class =  "slds-m-around_medium" >                                     <template if:true = {accounts}>                                        <div style= "height: 300px;" >                  ...