field rendering twice
I have a custom field renderer on a datetime field with a snippet that looks like this:

Any ideas?
var field = arguments[0], value = skuid.utils.decodeHTML(arguments[1]),I believe this was working fine before the new release but I might be wrong... Here is how my page looks now:
$ = skuid.$;
var model = skuid.$M('TempAdder');
if(value == null){
value = skuid.time.getSFDate(new Date());
value += 'T04:00:00';
model.updateRow(model.getFirstRow(),'End_Date__c',value);
console.log(value);
}
skuid.ui.fieldRenderers[field.metadata.displaytype][field.mode](field,value);

Any ideas?
1
Categories
- 7.9K Questions
- 926 Ideas
- 220 Discussion Categories
- 178 General
- 9 Community Feedback
- 3 Community Info
- 18 Knowledge Base
Comments
There are various ways you can branch your logic so that the renderer is not run twice, but here is one of them:
This was done to eliminate the need for a lot of JavaScript code whose only purpose was to sync up the UI after Model data changes were made. Skuid now handles this natively.
This shouldn't affect custom field renderers unless you are already doing things like finding all registered Lists and then calling list.render(), or if, like in this situation, you're calling updateRow() within a custom field renderer --- that is, if your Field Renderer has "side effects".
The biggest tool to be aware of when making Custom Field Renderers that will be helpful here is the initiatorId parameter that can be passed in to updateRow, and the field._GUID property. Another way to have rewritten the above code would be: This works because when you pass in the initiatorId parameter to updateRow you're letting Skuid know exactly which skuid.ui.Field is responsible for the update --- that way, Skuid knows NOT to tell this Field about the update after it has been processed, because Skuid assumes you already know about it, because you're the initiator, so of course you know about it, you caused it to happen!
After Skuid Model changes happen, Skuid will call various API methods (see "Overriding and Extending Editors" in this tutorial), but it will only call them on Fields, Items, Lists, Editors that did NOT initiate the data changes.