Folks,
I'm using RJS to add and remove rows from a list of items. Ideally, when the list is empty, there should be a single row "You have no items", otherwise the list looks confusing with the header but no items. Does anyone have a recipe for doing this?
Options include:
1. Update add and remove RJS templates to query the DB to get the item count, and remove/add the special row as necessary. Has concurrency issues.
2. When the page is initialized, put the display item count into the session, and update add/remove actions to keep it up-to-date. Update RJS templates as per option 1.
3. Implement a javascript function that takes the id of a list and iterates over its children, inserting the "You have no items" row if none.
I'm leaning towards option 2, but if there is a cleaner approach that would be awesome.
Cheers, Chris