AnApprentice
AnApprentice

Reputation: 110960

HTML, jQuery Suggestion for a List

I'm creating an app that will have a list of messages, each message can be either read or unread. Think GMAIL (though I'm not trying to rebuild that)...

My question is when I output all these messages, I need to list if the message is read or unread, I also need to provide the ability to change the message status, from read to unread. That being said, how do you suggest I stored this? A checkbox, a hidden input value? Any thoughts?

Thanks

Upvotes: 0

Views: 172

Answers (2)

Paul S
Paul S

Reputation: 36787

A checkbox could be a simple way to show whether or not the message is read, but I think that styling differences between the message headers (or whatever you're displaying on this page) would make for a better UI.

You could store a "message-type" associated with each message, that gets used to set a class when the page is built. When you toggle its status between read and unread, the styling will flip according to the rules you set for that status.

eg)

.unread{
 background-color:#DDDDDD;
 font-weight:bold;
}
.read{
 background-color:#FFFFFF;
 font-weight:normal;
}

Upvotes: 2

machineghost
machineghost

Reputation: 35790

A class if the read status has some visual effect (ie. the font goes from bold to normal), $(foo).data("read", true); otherwise.

I would definitely avoid the hidden INPUT; it's more hassle than the alternatives, and only really worth it if you need form submission of the state you're trying to track (and I'm guessing you don't have a form that needs to submit which messages are read?).

Upvotes: 1

Related Questions