I am working on a basic billing application, totally new to javafx.
Am done with adding and deleting the products from the table and also finding out the
You don't get the data from the cell, you get it from the model:
double totalCostOfSelectedItems = 0 ;
for (Data product : productSelected) {
totalCostOfSelectedItems = totalCostOfSelectedItems + product.getRTotal();
}
finalCost = finalCost - totalCostOfSelectedItems() ;
allProducts.removeAll(productSelected);
And of course you could always just recompute the total after removal instead, which would only be a performance issue if you had a huge number of products in the table:
allProducts.removeAll(productSelected) ;
finalCost = allProducts.stream().collect(Collectors.summingDouble(Data::getRTotal));
// update label...