Are you using a repeating panel (or just line item forms) for each database row you are displaying? The rest of this assumes you are, but that assumption might be wrong. If you’re not you probably should be if you are displaying and manipulating tabular data. I’m also assuming you are using a PostgreSQL database (I seem to remember you were going to).
In your database you would normally have a field that contains some unique value for each row. Often this is an autoincremented integer that the DB adds on each INSERT (see here to add one : https://stackoverflow.com/questions/7718585/how-to-set-auto-increment-primary-key-in-postgresql)
Make sure you retrieve this value in your SELECT and store it in your line item form (you don’t even have to display it), then on the checkbox “change” event you would UPDATE the table row using this stored unique value in the WHERE clause, for example :
UPDATE mytable SET selected=true WHERE unique_id=<the id you stored>
Remember that each instance of the line item form is self contained, so it will have no knowledge of the others.
Does that help?