Base solution for your next web application
Open Closed

How I can get data of one row and fill it to another component #6128


User avatar
0
GSOFT created

I have two questions.

  1. How can I get data in the row I select?
  2. Send data between two component.

It means When I click a row (I remove action button on per row), there is a button called "Accept", when I click this button, I can get its data and send it to another form like this.

Any idea is worth for me.


6 Answer(s)
  • User Avatar
    0
    GSOFT created

    UPDATE

    In "tr tag" I added <tr (click)="onSelect(record)">

    In component I write onSelect function

    onSelect(selectedItem: any) {
    		let branchCode = selectedItem.branch.brancH_CODE;
    		let branchName = selectedItem.branch.brancH_NAME;
    		console.log(branchCode);
    		console.log(branchName);
    		
    		//console.log("Selected item Id: ", selectedItem.branch.brancH_CODE); // You get the Id of the selected item here
    	}
    

    I already get the data that I need, but still don't know how to send to another component

  • User Avatar
    0
    ismcagdas created
    Support Team

    @GSOFT

    Just update the related object in your typescript file which target component uses. It should automatically update its UI.

  • User Avatar
    0
    GSOFT created

    Hi @ismcagdas I already did it. Parent component is received the data. That is object in my case, but when I try to log its property, it is undefined while the object has that property. I'm searching why it is undefiend.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @GSOFT

    Have you fixed your problem ?

  • User Avatar
    0
    GSOFT created

    @ismcagdas I already did it. Thank you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)