What is the best way to conditionally render properties in the builder for a custom component based on the values of other properties?
Should I just wrap an if statement around the property and push it into the basicPropsList?
If so, do I need the onChange function of the ‘parent’ property to be rebuildProps(), or is refresh() sufficient?
My propertiesRenderer is below. Based on the value of the defaultnametemplate property, I may need to render the patientmodel or the customdefaultname properties.
propertiesRenderer: function (propertiesObj,component) { propertiesObj.setTitle("Signature Component Properties");<br>var state = component.state;<br>var propCategories = s];<br> var signatureTypeMeta = skuid.$M('SignatureTypePicklistEntries').getField('Signature_Type__c');<br>var basicPropsList = t<br>{<br>id: "signaturemodel",<br>type: "model",<br>label: "Signature Model",<br>onChange: function(){<br>component.rebuildProps();<br>}<br>},<br>{<br>id: "signaturetype",<br>type: "picklist",<br> label: "Signature Type",<br> helptext: "Will create or update a condition on the model to set the Signature Type.",<br> picklistEntries: signatureTypeMeta.picklistEntries,<br> onChange: function(){<br> component.refresh();<br> }<br>},<br>{<br>id: "defaultnametemplate",<br>type: "picklist",<br>modelprop: "signaturemodel",<br>label: "Default Name",<br>location: "attribute",<br> picklistEntries: e<br> {<br> value: '{{{$User.name}}}',<br> label: 'User Name'<br> },<br> {<br> value: '{{{$Model.' + 'patientmodel' + '.data.0.Name}}}',<br> label: 'Patient Name'<br> },<br> {<br> value: 'Custom',<br> label: 'Custom'<br> }<br> ],<br> onChange: function(){<br> component.refresh();<br> }<br>},<br> {<br> id: "customdefaultname",<br> type: "template",<br> modelprop: "signaturemodel",<br> label: "Custom Default Name",<br> helptext: "Accepts global merge syntax, i.e. {{$User.name}} or {{$Model.Patient.data.0.Name}}.",<br> location: "attribute"<br> },<br> {<br> id: "patientmodel",<br> type: "model",<br> label: "Patient Model",<br> onChange: function(){<br> component.rebuildProps();<br> }<br> }<br>];<br>propCategories.push({<br>name: "Basic",<br>props: basicPropsList,<br>});<br>if(skuid.mobile) propCategories.push({ name : "Remove", props : s{ type : "remove" }] });<br>propertiesObj.applyPropsWithCategories(propCategories,state);<br>},