how to remove the data also from the removed row of the table in angular
NickName:shubham79 Ask DateTime:2018-04-16T17:22:37

how to remove the data also from the removed row of the table in angular

I have an add new row button as well as remove a row button.

At First, I added multiple rows with data in it.

But when I remove one of the rows out of the table it gets removed but data is still there. Whenever I try to add one more row below it, the new row is populated with the previous data.

//Add row button

<input type="submit" class="btn btn-default btn-circle btn-lg" title="{{'AddMore'|translate}}" value="+" ng-click="addNewRow()">

//Remove row button

<input type="submit" class="btn btn-default btn-circle btn-lg" title="{{'Remove'|translate}}" value="-" ng-click="removeNewRow(formula_id)">

$scope.forCalculation = [{}];
        $scope.addNewIteration = [{}];
        $scope.addNewRow = function (addNewIteration) {
            $scope.addNewIteration.push({
                'INCI_name': "",
                'batch_no': "",
                'percentage': "",
                'quantity': "",
                'price': "",
                'formula_id': 0
            });
            $scope.forCalculation.push({'remaining_quantity': 0});
            $scope.AN = {};
        };

//above function has been used to add the new blank row.

$scope.removeNewRow = function(formula_id){
            var index = -1;
            var iterArr = eval($scope.addNewIteration);
            for(var i=0; i<iterArr.length; i++){
                if(iterArr[i].formula_id === formula_id){
                    index = i;
                    break;
                }
            }
            /*if(index === -1){
                alert("Something went wrong");
            }*/
            $scope.addNewIteration.splice(index, 1);
        };

//this function has been used to remove one row at a single call of the function. But the data is not removed.

Please help me out finding the missing logic.

Copyright Notice:Content Author:「shubham79」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/49853781/how-to-remove-the-data-also-from-the-removed-row-of-the-table-in-angular

More about “how to remove the data also from the removed row of the table in angular” related questions

how to remove the data also from the removed row of the table in angular

I have an add new row button as well as remove a row button. At First, I added multiple rows with data in it. But when I remove one of the rows out of the table it gets removed but data is still...

Show Detail

How to Remove a row from Table using angular js?

I am using Angular http service to perform a DELEET operation , Its working fine , after deleting the data record I have to remove that row also from table . Below is my code for all that $scope.

Show Detail

How to remove a row from a child table if it is removed from a parent one?

Here is a simple shema: sqlite&gt; .schema recordtypes CREATE TABLE recordtypes (record_id text primary key); sqlite&gt; .schema headers CREATE TABLE headers (header_id text primary key); sqlite&g...

Show Detail

Angular Kendo Grid keeps details of removed master row visible

I am using an angular-kendo-grid (version 6.14.5) in angular 10.0.3 with a kendoGridCellTemplate to show details. &lt;kendo-grid #KendoGrid [data]=&quot;gridSettings.gridView&quot; (...) &gt; &lt;

Show Detail

Remove data row from table with button

I'm trying to remove data from my database with a "Delete"-button. My data is displayed in a table and I added an extra column with a button, which should delete ONLY the data from that row. The w...

Show Detail

Scroller move to top of table when remove row from data table jquery plugin

I am using data table in my angular js Application as angular Directive and passing data to it using "=" scope.When remove row using row.remove.draw() scroller moves to top of table. This is my cod...

Show Detail

Issue when appending a new row to a table and then trying to remove it

I'm having an issue when I try to remove a row that I recently appended to a table. I have 2 tables in the same view. The first table has some unassigned users, each row has its own buttton to assign

Show Detail

Can not remove the expected row from table using Angular.js

I have an issue.I need to remove one particular row from table structure of my app using Angular.js.My code is present inside the below plunkr link. code is present here In the above code create ...

Show Detail

How to remove a row from a table

I have an html table, and on each row, i would like to add a delete button. When the user clicks on it, I would like to do two things: 1) remove the row from the table. 2) extract data from the ...

Show Detail

ARIA announce that data has been added or removed from a table?

I am working on an Angular app where a user clicks a button which causes data to be added to or removed from the data source of a table elsewhere on the page. When the user clicks the button, data is

Show Detail