views:

278

answers:

2

Following on from - http://stackoverflow.com/questions/1591467/deep-nested-xml

I have a checkbox renderer i am placing into my Datagrid. The checkbox needs to do a sql query on the sqllite database and see if the show is marked as watched, if it is then make the checkbox as checked and if not mark the checkbox and not checked.

What i would like to do further to this is add the watched items to one XMLList and add the not watched episodes to a different XMLList and have the checkbox on click= move from one to the other list as per watched or not.

http://pastebin.org/46383 - sql query class file.

http://pastebin.org/46384 - watchedRenderer file.

http://pastebin.org/46385 - datagrid displaying the checkbox and other info.

+1  A: 

1) if you did that you'd have 1 query to select all the shows and then 1 query for each show. This is NOT a good idea. Why not simply make a JOIN with the watched field on the first select query?

2) simply update each datagrid item, and dinamycally generate the 2 xmllists with filterfunctions or loops checking you condition.

luca
1 - there is no sql query at all at the moment, when a show is selected it does a httpservice request and pulls XML data into a xmllist. I need it to check each episode in the xmllist and see if it is watched in the sql database and then determine witch datagrid to display it in.2 - relys on no.1
medoix
+1  A: 

Another strategy might be to load your database to the front-end at the start of your program, and then save your data to the back-end at the end of your program. In this way, you can just query each "object.isWatched" in your dataProvider.

Luis B