deleting multiple rows using check box select and knockout

deleting multiple rows using check box select and knockout

HTML

<table class="pure-table" id="tbl_ordered_products">
        <thead>
            <tr>
                <th><input type="checkbox" id="chkAllProducts" /></th>
                <th>Product Code</th>
                <th>Product Name</th>
                <th>Price</th>
                <th>Quantity</th>
                <th>Discount Rate</th>
                <th>Stock Balance</th>
                <th>Total Discount</th>
                <th>Orig. Price</th>
                <th>Total</th> 
            </tr>
        </thead>
        <tbody data-bind="foreach: orderedProducts">
            <tr>
                <td><input type="checkbox" id="chkAllProducts" data-bind="checked: $data.isChecked"/></td>
                <td data-bind="text: product_code"></td>
                <td data-bind="text: name"></td>
                <td data-bind="text: price"></td> 
                <td><input data-bind="value: quantity" /></td>
                <td><input data-bind="value: discount" /></td>
                <td data-bind="text: balance"></td>
            </tr>    
        </tbody>
    </table>

<input type="button" value="Remove Selected" data-bind="click: deleteSelectedProducts" />

JavaScript

function Product(id, product_number, name, price, quantity, discount, balance) {
var self = this;
self.isChecked = ko.observable(false)
self.id = ko.observable(id);
self.product_code = ko.observable(product_number);
self.name = ko.observable(name);
self.price = ko.observable(price.toFixed(2));
self.quantity = ko.observable(quantity);
self.discount = ko.observable(discount);
self.balance = ko.observable(balance);
}
function OrdersViewModel() {
var self = this;

self.customerCode = ko.observable();
self.full_name = ko.observable();
self.complete_address = ko.observable();
self.birthday = ko.observable();
self.email = ko.observable();
self.contact = ko.observable();

self.orderedProducts = ko.observableArray();

self.deleteSelectedProducts = function () {
    var productToRemove = [];
    ko.utils.arrayForEach(self.orderedProducts(), function(product){
       if (product.isChecked()) 
       {
           productToRemove.push(product)
       }
    }
    )
    self.orderedProducts.removeAll(productToRemove)
}
}
window.vm = new OrdersViewModel()
ko.applyBindings(vm)

for (var i = 0; i< 5; i++)
  vm.orderedProducts.push(new Product("id" + i, "number" + i,"name" + i, 20 * i, "q" + i, "d" + i, "p" + i))