Hi,
I have a custom field renderer to populate a picklist,
I have gone through this post : https://community.skuid.com/t/field-rendering-twice
I am not actually doing any update in field renderer snippet but in other snippet which I am running on a model action.
any one has an idea why this is happening ?
Here is my field renderer snippet :
var field = arguments[0], value = arguments[1],
$ = skuid.$;
var addressModel = skuid.$M(‘Address’);
var addrRows = addressModel.getRows();
console.log('field = ',field);
console.log('value = ',value);
var picklistEntries = field.metadata.picklistEntries;
console.log('addresses ==== ',addrRows);
picklistEntries.length = 0;
$.each(addrRows, function(){
picklistEntries.push(
{
value: this.Name+this.Id,
label: this.Primary__c ? "Primary Address-"+this.Name : this.Name,
defaultValue: this.Primary__c ? true : false,
active: true
}); //add Name field i.e. Address Line-1 Field Value as pick list entry
});
console.log(‘picklistEntries ===’,picklistEntries);
if(picklistEntries.length){
skuid.ui.fieldRenderersefield.metadata.displaytype]field.mode;
}
Please find below XML for whole Page :
row.created
row.updated
AddressList_ui
Address to Pick
Selected Address Details
var field = argumentsr0],
value = argumentsr1],
$ = skuid.$;
var addressModel = skuid.$M(‘Address’);
var addrRows = addressModel.getRows();
console.log('field = ',field);
console.log('value = ',value);
var picklistEntries = field.metadata.picklistEntries;
console.log('addresses ==== ',addrRows);
picklistEntries.length = 0;
$.each(addrRows, function(){
picklistEntries.push(
{
value: this.Name+this.Id,
label: this.Primary__c ? "Primary Address-"+this.Name : this.Name,
defaultValue: this.Primary__c ? true : false,
active: true
}); //add Name field i.e. Address Line-1 Field Value as pick list entry
});
console.log(‘picklistEntries ===’,picklistEntries);
if(picklistEntries.length){
skuid.ui.fieldRenderersifield.metadata.displaytype]field.mode;
}
var params = argumentsr0],
$ = skuid.$;
var selAddrModel = skuid.$M(‘Address’);
var selAddrRow = selAddrModel.getFirstRow(); //selectedAddressID_ui
var pickListValue = selAddrModel.getFieldValue(selAddrRow,‘AddressList_ui’);
console.log('FROM UTIL pickListValue = ',pickListValue);
console.log('pickListValue.substr(pickListValue.length-18) ====== ',pickListValue.substr(pickListValue.length-18));
if(pickListValue){
selAddrModel.updateRow(selAddrRow,
{
selectedAddressID_ui : pickListValue.substr(pickListValue.length-18)
});
}