Custom picklist renderer when option source is a model

Hey J, I ran into another use case for me to use this snippet. I am turning a number field into a picklist with values that increment by 5. So basically I’m adding 5,10,15,20 etc to a picklist. It’s working great except that if the current value is 20, and the user clicks edit, the picklist seems to rebuild itself so the selected value shows up as 5 (which is the lowest number). Is there some kind of “setSelectedIndex()” function built in or something that can have the value start off as the current value of the field? My snippet looks like this:

var field = arguments[0],&nbsp; &nbsp; value = skuid.utils.decodeHTML(arguments[1]),<br>&nbsp; &nbsp;$ = skuid.$;<br>if(field.mode === 'edit'){<br>&nbsp; &nbsp; var customOpts = [];<br>&nbsp; &nbsp; &nbsp; &nbsp; customOpts.push({<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 5, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '5' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 10, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '10' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 15, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '15' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 20, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '20' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 25, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '25' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 30, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '30' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 35, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '35' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; },{<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value : 40, &nbsp; &nbsp; &nbsp; &nbsp; // Will be stored in target object&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; label : '40' &nbsp; &nbsp; &nbsp; &nbsp;// Will display in the PICKLIST<br>&nbsp; &nbsp; &nbsp; &nbsp; });<br>&nbsp; &nbsp; //Render the options as a PICKLIST<br>&nbsp; &nbsp; var customSelect = skuid.ui.renderers.PICKLIST.edit({<br>&nbsp; &nbsp; &nbsp; &nbsp; entries : customOpts,<br>&nbsp; &nbsp; &nbsp; &nbsp; required : true,<br>&nbsp; &nbsp; &nbsp; &nbsp; value : customOpts<br>&nbsp; &nbsp; }).change(function(){<br>field.model.updateRow(field.row,'Bandwidth__c',skuid.$(this).val(),{initiatorId: field._GUID});<br>alert('Bandwidth changes will not be sent to the Pricing Team automatically, you must notify them yourself.');<br>});<br>&nbsp; &nbsp; //Append the PICKLIST to the DOM element<br>&nbsp; &nbsp; field.element.append(customSelect);<br>}else{<br>&nbsp; &nbsp; skuid.ui.fieldRenderers.INTEGER[field.mode](field,value);<br>}&nbsp;