Uncaught TypeError: Cannot read property '0' of null skuid__SkuidJS:26
mB Pat Vachon, Champion
-
42,926 Points
Posted 4 years ago
Andrew Duensing, Employee
-
740 Points
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.
Ben Hubbard, Employee
-
12,530 Points
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.
Then use displayTypeToUse instead of field.metadata.displaytype.
Try adding this line above the renderer code.
var displayTypeToUse;
if (field.metadata.displaytype === 'COMBOBOX') {
displayTypeToUse = 'TEXT';
} else {
displayTypeToUse = field.metadata.displaytype;
}
Then use displayTypeToUse instead of field.metadata.displaytype.
Ben Hubbard, Employee
-
12,530 Points
That said, we need to fix Skuid so that your original code would work and not bomb like that.
Ben Hubbard, Employee
-
12,530 Points
Can you paste in the exact code you're trying? I'll try it on the same field.
mB Pat Vachon, Champion
-
42,926 Points
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); }
Ben Hubbard, Employee
-
12,530 Points
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);
}
mB Pat Vachon, Champion