deitch/jstree-grid — pull request #3 by ChrisRaven (2011-11-29 22:01:10+00:00)
Title: Replace text values with images if needed

Here's another option for configuration of jstree-grid. This one allows to assign to values paths/urls or classes and then replaces text values with appropriate images. Each column can have separate set of images, there could be a default image or values which not match will be left as text. Example will be best to show this, I suppose.
Here is a fiddle with working example: http://jsfiddle.net/jnwD8/

And here is, how should example configuration looks like:
'grid': {
columns: [
{width: 200, header: "Nodes"},
{
width: 40,
header: "rate",
value: "rate",
images: {
1: '*ui-icon ui-icon-star',
'value with spaces': '*some-class-with-background-set-to-image',
abc: 'img.png',
default: 'images/not_rated.png'
}
}
]

If default image is omited, then not matching values will be left as text.
If user want to set class, then he should start it with "*". It allows to differentiate between classes and filenames (filenames cannot have asterisks in its names).
There is possibility to put more then one class (it is quite common actually when using sprites). In that case the asterisk should be only before first class. There couldn't be any character (including spaces) before the asterisk.
File can be local or remote - user can put [path/]filename.ext or url in config.