Snippet examples.....

  • 1
  • Question
  • Updated 5 years ago

Does anyone know if there is a resource in the community or on Github with Snippet examples ?

I'm not a Javascript prorammer but I can copy and paste very well.....;)

For instance, i need one to align all fieldvalues TOP in a view and one for having the fontsize 6 pts

any other examples are welcome as well

Photo of Eddy


  • 364 Points 250 badge 2x thumb

Posted 5 years ago

  • 1
Photo of Eddy


  • 364 Points 250 badge 2x thumb
hmmm i set it to "Problem" , it is a question..... i'm sorry
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,678 Points 20k badge 2x thumb
Setting the post to "problem" is really not a problem... 

We do not have a consolidated list of Snippet examples. The best thing to do is hunt through the community. I often do things like search for "snippet" or "javascript" and then review the resulting 30 or 40 posts to see if any are close to my use case. 

I know its not ideal,  but its what we've got right now. 
Photo of Glenn Elliott

Glenn Elliott, Champion

  • 7,748 Points 5k badge 2x thumb
Eddyzz ... I've been in the same boat and found the examples on the community invaluable. Here's a couple of mine (hacked together from bits found on the community) to get you started:

1. Custom field renderer (snippet) used for Task Due Date. It adds a CSS class if the task is overdue, which we then use to style it red.

//Adds CSS classes to allow for conditional formatting
var field = arguments[0], value = skuid.utils.decodeHTML(arguments[1]);
var today = new Date();
today.setHours(0,0,0,0); //Returns today at midnight
today = Date.parse(today);
value = Date.parse(value);
//Add the class if the due date is earlier than today at midnight
if (field.mode == 'read' && value < today) {

2. Custom field renderer (snippet) used for various currency fields. It aligns the text right.

var field = arguments[0], value = arguments[1], metadata = field.metadata,
dt = metadata.displaytype;
field.element.css({'text-align': 'right'});
// Run the field's default renderer
Photo of Eddy


  • 364 Points 250 badge 2x thumb
Great stuff Glenn, thank you very much !