Skip to main content

I have followed the instructions on this page to create a drag and drop queue. I wanted to display more data on the card but some of the data I want to conditionally show. I wrote an ‘if’ statement to do this and the correct info prints in the console but not on the template.


Basically if the deadline field has a value then show the value otherwise don’t.


Can someone point out the error of my ways?


Thanks!


Altered Code:


var args = argumentsu0], item = args.item, list = args.list, model = args.model, element = args.element, row = item.row, deadline = row.Custom_Field__c, renderTemplate = '{{{Name}}} 
{{Amount}}
' if(deadline !== ""){ "D:"+ deadline; console.log('Deadline' + deadline); } else{ null; }


Original Code:

  1. var args = argumentsu0],

  2. item = args.item,

  3. list = args.list,

  4. model = args.model,

  5. element = args.element,

  6. row = item.row,

  7. renderTemplate = '{{{FirstName}}} {{{LastName}}} - {{{Company}}}',

  8. mergeSettings = {

  9. createFields: true,

  10. registerFields: true

  11. };



  12. element.html(

  13. skuid.utils.merge('row',renderTemplate,mergeSettings,model,row)

  14. );

Can anyone see why this is printing in the console but not in the template?


I figured this out. In case this can help anyone else.


var args = arguments[0], item = args.item, list = args.list, model = args.model, element = args.element, row = item.row; var deadline = row.Custom_Field__c; if(deadline !== undefined || 0){ renderTemplate = '{{{Name}}} 
{{Amount}}
GD:{{{Custom_Field__c}}}';

console.log('Deadline' + deadline); } else{ renderTemplate = '{{{Name}}} 
{{Amount}}
'; } mergeSettings = { createFields: true, registerFields: true }, $ = skuid.$; element.html( skuid.utils.merge('row',renderTemplate,mergeSettings,model,row) ). draggable({ revert: 'invalid', appendTo : 'body', helper : function() { var original = $(this); var helper = original.clone(); // Pass along a reference to the current list's contents // so that we can compare lists // to ensure we're not allowing dropping on the current list original.data('listContents',list.contents); helper.css({ 'z-index' : 1000, 'width' : $(this).css('width'), 'height' : $(this).css('height'), 'border' : '1px black solid', 'padding' : '4px', 'background-color' : '#EEE', 'font-family': 'Arial,Helvetica,sans-serif', 'cursor':'move' }); return helper; } });


Tami~

Glad you were able to figure it out!

Thanks for sharing what you learned with the community!
Karen