Task Subject Field Accepting Custom Field Renderer

Uncaught TypeError: Cannot read property ‘0’ of null           skuid__SkuidJS:26



Hey Pat, since this looks like it’s pretty specific, do you think you could open the dev tools, click on the console, and then give us a screenshot of the errors that come up when you refresh the page with the custom field rendered applied to the field that is breaking it.

Subject is a weird field.  It has a display type of COMBOBOX which skuid does not have a renderer for.

Try adding this line above the renderer code.

var displayTypeToUse;<br>if (field.metadata.displaytype === 'COMBOBOX') {<br>&nbsp; &nbsp; displayTypeToUse = 'TEXT';<br>} else {<br>&nbsp; &nbsp; displayTypeToUse = field.metadata.displaytype;<br>}



Then use displayTypeToUse instead of field.metadata.displaytype.

That said, we need to fix Skuid so that your original code would work and not bomb like that.

Still no dice.

Can you paste in the exact code you’re trying?  I’ll try it on the same field.

var $ = skuid.$, field = arguments[0], value = arguments[1]; if (field.mode === 'read') { field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(field.model.getFieldValue(field.row,skuid.utils.getFieldReference(field.id,field.metadata)))); } else { skuid.ui.fieldRenderers.TEXT.edit(field,value); }

The skuid.utils.getFieldReference() will only work on REFERENCE type fields. For non reference fields, you can just use value to put into the text. Like this…


var $ = skuid.$,    field = arguments[0],
    value = arguments[1];
if (field.mode === 'read') {
    field.element.append(skuid.$('<div>').addClass('nx-fieldtext').text(value));
} else {
    skuid.ui.fieldRenderers.TEXT.edit(field,value);
}

Yup. That was it.