Another neat feature that Lift provides is Cells, which like cells in a spreadsheet can be wired together, so when the value of one cell changes, it automatically updates the value of another one.
In this recipe, I'll mix Ajax forms with Cells to teach you how to create a dynamic shopping cart. Thus, when the user updates the quantity of a given item he or she wants to purchase, the total amount per item and the total shopping cart amount will be updated.
You can use the code from the examples we've used in the previous recipes, or you can start a new project.
Modify the index.html
file by removing everything inside the div
tag, with main as the value of the id
field, and add the following code into it:
<div data-lift=" ShoppingCart.show"> <table> <thead> <tr> <th>Item</th> <th>Quantity</th> <...