function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lightning PracticeLightning Practice 

add row fucntionality in lightning to save info to database?

HI all,

add row fucntionality in lightning to save info to database? 

unable to save to database.
 
Thanks ,
karthik
SandhyaSandhya (Salesforce Developers) 
Hi,

Refer below blogs which have sample code.

http://biswajeetsamal.com/blog/dynamic-add-delete-row-in-lightning-component/
 http://sfdcmonkey.com/2017/08/09/add-delete-rows-dynamic/
 
Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
 
Best Regards
Sandhya
 
Lightning PracticeLightning Practice
Hi Sandya,
I have gone through those links , i need in one component instead of multiple compoentns 

Thanks,
Ram.
Lightning PracticeLightning Practice
Hi all ,

How to push newly added row values to database in one component itself?
 
addRowContacs : function(component,event){
        component.set("v.savebutton",true);
       
        var contacts=component.get("v.contacts");
        console.log('contacts'+contacts);
        var len = contacts.length;
       
        contacts.push({
            
            'Name':'',
            'Email':''
           
        });
         
        component.set("v.contacts",contacts);
after giving input values UI how to push them to Database 
 
saveContacts : function(component,event){
        alert('hello iam saving')
        var getContacts =component.get("v.contacts");
        var action = component.get("c.saveaddedContacts"); 
        
        action.setParams({
            "lstOfcontacts": component.get("v.contacts")
        });
        
        // set call back 
        action.setCallback(this, function(response) {
            alert(response.getReturnValue());
            var state = response.getState();
            if (state === "SUCCESS") {
                
                component.set("v.contacts",  []);

                 
            }
        });
        // enqueue the server side action  
        $A.enqueueAction(action);
        
    }

NOt able to call controller and save to database 
can any one help?
Thanks,
Ram