We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Copy/duplicate a Row

Hello,

I want to implement some kind of copy row feature to my grid so you can select a row, click on a button on the toolbar and simply get the content of that row in the input fields of a new row. Is this possible?

Thanks

1 Reply

VA Venkatesh Ayothi Raman Syncfusion Team June 10, 2016 08:55 AM UTC

Hi Arthur, 

Thank you for contacting Syncfusion support. 

We have achieved your requirement “Copy the record data while clicking the record and insert the copied data to new added record fields” using recordClick and actionComplete event in Grid. Please refer to the code example, sample and Help document, 

Code example: 
<GRID> 
@(Html.EJ().Grid<object>("FlatGrid") 
        . . . .  
              .ClientSideEvents(e=>e.RecordClick("recordClick").ActionComplete("actionComplete")) 
        .Columns(col => 
        { 
            . . . 
             
        })) 
 
 
<Record Click> 
 
function recordClick(args) { 
 
        //Save the data while select the record. 
        OrderID = args.data["OrderID"] 
       
        CustomerID = args.data["CustomerID"]; 
       
        EmployeeID = args.data["EmployeeID"]; 
       
        Freight = args.data["Freight"]; 
        OrderDate = args.data["OrderDate"]; 
        ShipCity = args.data["ShipCity"]; 
 
 
    } 
 
<ActionComplete> 
 
function actionComplete(args) { 
 
        if (args.requestType == "add" && this.model.isEdit) 
        { 
 
            //store the saved data into new added row 
 
            $("#" + this._id + this.model.columns[0]["field"]).val(OrderID); 
            $("#" + this._id + this.model.columns[1]["field"]).val(CustomerID); 
            $("#" + this._id + this.model.columns[2]["field"]).val(EmployeeID); 
            $("#" + this._id + this.model.columns[3]["field"]).val(Freight); 
            $("#" + this._id + this.model.columns[4]["field"]).val(OrderDate); 
            $("#" + this._id + this.model.columns[5]["field"]).val(ShipCity); 
 
 
 
           
        } 
 
    } 
     



Help document: 

 
Regards, 
Venkatesh Ayothiraman. 


Loader.
Live Chat Icon For mobile
Up arrow icon