I’ve got a custom field renderer in a table column that show’s a blank input below the current value of the field. It’s working except that it loses focus after entering a few characters in the input. I found this topic which describes what I’m seeing as well.
However, I’m not sure if I can implement a solution similar to the one suggested: use a different model.
Here’s the snippet for the custom renderer:
var $ = skuid.$, params = arguments 0],
values = arguments 1],
model = arguments 0].model,
row = arguments 0].row,
mode = arguments 0].mode;
element = arguments 0].element;
// A shortcut function to save some complexity below
function renderField( fieldName){
var field = new skuid.ui.Field( row, model, null, { fieldId: fieldName, register: true } ),
value = model.getFieldValue( row, fieldName );
skuid.ui.fieldRenderersefield.metadata.displaytype]dmode]( field, value );
return field.element;
}
function truncateWithEllipses(text, max) {return text.substr(0,max-1)+(text.length>max?'...':''); }
var oV;
var rowId = row.Id;
var valT;
//only display the first 30 chars of this field
try{
valT = truncateWithEllipses(values, 30);
} catch(e) {
valT = values;
}
//get the original value
try {
oV = model.originals4rowId].Latest_Update__c;
} catch (e) {
oV = values;
}
if (mode==='edit'){
element.append($('<span>').text(oV), renderField('Latest_Update__c');
} else {
element.append($('<span>').text(valT));
}
Is it possible to use a field from a different model (UI only) in a custom renderer?