Snippet examples.....

EddyEddy Member
edited April 2017 in Questions
Hello, 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 Eddy


  • EddyEddy Member
    edited January 2014
    hmmm i set it to "Problem" , it is a question..... i'm sorry
  • Rob HatchRob Hatch Skuad ✭✭
    edited September 2016
    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. 
  • Glenn ElliottGlenn Elliott Member
    edited April 2017
    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]); skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value); 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) { field.element.addClass("overdue"); } 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 skuid.ui.fieldRenderers[metadata.displaytype][field.mode](field,value);
  • EddyEddy Member
    edited January 2014
    Great stuff Glenn, thank you very much ! Eddy
Sign In or Register to comment.