Hello All!
I have an interesting situation, please bear with me, as I’m unsure how to describe it.
I am attempting to implement a Detail View/Edit system for users to be able to adjust what they see on their ‘products’ list with a “Favorite” or “Hide” system.
The issue is that there are actually 3 states… 1. Normal (null), 2. Favorite (1), 3. Hide (2)
I have a ‘favhidestate’ table setup with fields:
id, sourceuser, destproduct, favhidestate
Most of the relationships between users and products will be “Normal” (i.e. there won’t be a record in the database to show the “Normal” state, I’ll only need to add “Favorite” (1) or “Hide” (2) states to the detail table.
I’ve got it kind-of working, however only with a drop-down list in the detail view/edit, and only if I pre-populate the detail table with data.
If I don’t have a record in the detail table between a user and a product, then the detail view/edit isn’t even displayed. Seems there MUST be a detail record for it to even give the option to set a new value.
I have a dropdown created with the following values for favhidestate
[blank] - Normal View
1 - Favorite
2 - Hide
The first question that comes to mind, is there a way to force the detail view to be displayed, even if there isn’t a record match?
(Seems I have to have data in the table like :
1, 22, 2
1, 23, 1
1, 25, NULL
Considering that 98% of users will be displaying most products in “Normal” mode, I can’t imagine a table that has every combination of user to product with a NULL entry in the database. (or is this normal practice to just let the table bloat??)
My goal is to:
- display the detail table for products even if there isn’t an entry in the table.
- When a user sets the value back to “Normal” view (i.e a ‘NULL’ in favhidestate), the record is DELETED.
I hope this makes sense!
Thank you,
BK