SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <aura:component controller="AccountsController" implements="lightning:actionOverride,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" access="global" >
  2.  
  3.  
  4.  
  5.      <aura:attribute name="accounts" type="Account[]"/>
  6.      <aura:attribute name="accounts2" type="Account[]"/>
  7.     <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
  8.  
  9.  
  10.          <ui:button class="slds-align_absolute-center" label="Click Me To Popup!!!" press="{!c.openmodal}"  />
  11.        <!-- this div gives a pop up of the page-->
  12.           <div role="dialog" tabindex="-1" aria-labelledby="header43" aura:id="Modalbox" class="slds-modal slds-modal_large">
  13.        <div class="slds-modal__container" style="width: 10%;">
  14.            <div class="slds-modal__header">
  15.                EDIT
  16.     <aura:iteration items="{!v.accounts}" var="account" indexVar="accountKey">
  17.     <tr id="{!'tr'+accountKey}">
  18.         <th> {!'tr'+accountKey} </th>
  19.         <th scope="col">
  20.             <ui:inputCheckbox Text="{!account}" aura:id="accountSelected" />
  21.         </th>
  22.         <th scope="col">
  23.             <ui:outputText aura:id="Name" value="{!account.Name}"/>
  24.         </th>
  25.         <th scope="col">
  26.             <ui:outputText aura:id="street" value="{!account.BillingStreet}"/>
  27.         </th>  
  28.         <th scope="col">
  29.             <ui:outputText aura:id="city" value="{!account.BillingCity}"/>
  30.         </th>
  31.         <th scope="col">
  32.             <ui:outputText aura:id="state" value="{!account.BillingState}"/>
  33.         </th>
  34.  
  35.     </tr>
  36. </aura:iteration>
  37.            </div>
  38. <lightning:button variant="brand" label="Process" onclick="{!c.processButton}" />
  39.                 <div class="slds-modal__footer">
  40.                     <ui:button label="close" press="{!c.closeModal}"  />
  41.                 </div>
  42.             </div>  
  43.               </div>
  44.  
  45.         <div class="slds-backdrop " aura:id="Modalbackdrop"></div>  
  46. </aura:component>
  47.      
  48. ({
  49.     closeModal:function(component,event,helper){    
  50.         var cmpTarget = component.find('Modalbox');
  51.         var cmpBack = component.find('Modalbackdrop');
  52.         $A.util.removeClass(cmpBack,'slds-backdrop--open');
  53.         $A.util.removeClass(cmpTarget, 'slds-fade-in-open');
  54.         },
  55.     openmodal:function(component,event,helper) {
  56.         var cmpTarget = component.find('Modalbox');
  57.         var cmpBack = component.find('Modalbackdrop');
  58.         $A.util.addClass(cmpTarget, 'slds-fade-in-open');
  59.         $A.util.addClass(cmpBack, 'slds-backdrop--open');
  60.     },
  61.     Submitmodal:function(component,event,helper){
  62.          var tes1=component.get("v.test1");
  63.          var tes2=component.get("v.test2");
  64.          console.log(tes1);
  65.          console.log(tes2);
  66.  
  67.     },
  68.     doInit: function(component, event, helper) {      
  69.         var action = component.get('c.getAccounts');
  70.         console.log(action);
  71.         // Set up the callback
  72.         var self = this;
  73.         action.setCallback(this, function(actionResult) {
  74.             component.set('v.accounts', actionResult.getReturnValue());
  75.         });
  76.         $A.enqueueAction(action);
  77.     },
  78.     processButton: function(component, event, helper) {
  79.         debugger;
  80.         console.log("this is logo");
  81.         var le = component.find("accountSelected").length;
  82.         console.log(le);
  83.         for( var i=0; i < component.find("accountSelected").length; i++) {
  84.             if( component.find("accountSelected")[i].get("v.value") == true ){
  85.                 var element = document.getElementById('tr'+i);
  86.                 console.log('tr'+i);
  87.                 element.style.backgroundColor='#800';
  88.                 element.style.color='white';
  89.                 element.style.textAlign='center';
  90.                 Console.log("here I wan to get selected accounts ");
  91.                 ****<!--  How can i get the accounts values selected ones  -->****
  92.  
  93.             } else {
  94.                 var element = document.getElementById('tr'+i);
  95.                 element.style.backgroundColor='#fff';
  96.                 element.style.color='black';
  97.                 element.style.textAlign='center';
  98.             }
  99.         }
  100.     }
  101.  
  102. })
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top