Created
June 5, 2012 04:56
-
-
Save lsmith/2872732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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