Advertisement
kpammi

caseFeedPublisherController

Mar 5th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ({
  2.     buttonClicked : function(component, event, helper) {
  3.         alert("Button Clicked");
  4.     },
  5.     /**
  6.     Method: displayAttachments
  7.     Return Value: null
  8.     Description: Launched when attachment list is changed.
  9.     Updates or creates new Attachement DOM elements on the component
  10.     */
  11.     displayAttachments : function(component, event, helper){
  12.         console.log("==>caseFeedPublisher Method:displayAttachments");
  13.         var inputFileControl = component.find("attachFile").getElement();
  14.         var inputFileList = inputFileControl.files;
  15.         var inputFileLength = inputFileList.length;
  16.         console.log("No of attachments:"+inputFileLength);
  17.         for(var i=0; i<inputFileLength;i++){
  18.             console.log("=============>File Number: "+i);
  19.             console.log("File Name: "+inputFileList[i].name);
  20.             console.log("File Type: "+inputFileList[i].type);
  21.             console.log("File Size: "+inputFileList[i].size+" bytes");
  22.             $A.createComponent(
  23.                 "c.caseFeedCommentAttachment",
  24.                 {
  25.                     "filename": inputFileList[i].name,
  26.                 },
  27.                 function(newComponent){
  28.                     if(component.isValid()){
  29.                         var showAttach = component.get("v.attachments");
  30.                         console.log("showAttach size: "+showAttach.length);
  31.                         showAttach.push(newComponent);
  32.                         console.log("showAttach size: "+showAttach.length);
  33.                         component.set("v.attachments",showAttach);
  34.                     }
  35.                 }
  36.                 );
  37.         }
  38.  
  39.     },
  40.  
  41.     handleRemoveAttachment : function(component, event, helper){
  42.         console.log("In case Feed Publisher: Event Handled");
  43.     }
  44. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement