Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created June 5, 2012 04:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmith/2872732 to your computer and use it in GitHub Desktop.
Save lsmith/2872732 to your computer and use it in GitHub Desktop.
columns: [
'item',
'cost',
{
key: 'price',
allowHTML: true,
formatter: function (o) {
var words = o.value.split(/\s+/),
i = words.length,
word;
while (i--) {
word = words[i].toLowerCase();
if (word === 'mark') {
// wrap the word with an element with a css class. Put the
// colors or other visual treatment in the css for that class.
// Note words[i] is used on the RHS instead of word to preserve case
words[i] = '<span class="mark">' + words[i] + '</span>';
} else if (... other conditions ...) { ... }
}
return words.join(' ');
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment