concept issue: defining functions for field properties
See original GitHub issueGreat stuff!
However there seems to be an issue with the concept of defining functions for fields properties and validators as standard JSON does not allow / support to generate JSON containing javascript functions like the following:
{
type: "select",
label: "Type",
model: "type",
values: [
{ id: "personal", name: "Personal" },
{ id: "business", name: "Business" }
]
},{
type: "text",
label: "Company name",
model: "company.name",
visible: function(model) {
return model && model.type == "business";
}
}
The workaround from #149 does not work in version 3.
Is there any know way to solve this??
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Function Fields - TechDocs
Function fields are special types of fields that you can use in device designs and action diagrams. The attributes of a function field...
Read more >Introduction to data types and field properties - Microsoft Support
Every table in Access is made up of fields. The properties of a field describe the characteristics and behavior of data added to...
Read more >Function field - Product Documentation | ServiceNow
Create function fields and scripts in the Now Platform to perform common database transformations and calculations.
Read more >Field (mathematics) - Wikipedia
In mathematics, a field is a set on which addition, subtraction, multiplication, and division are defined and behave as the corresponding ... Function...
Read more >Method definitions - JavaScript - MDN Web Docs
Method definition is a shorter syntax for defining a function property in an object initializer. It can also be used in classes.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I also handled this in a similar fashion. Although a bit more work but very flexible. I have a parser that finds any key with the
_calc
extension and converts the value to an evaluated function and added as a getter. This way it works with all keys anywhere in the schema.eg
My technique replaces the raw key with the getter function
I’m not a big fan of evaluating a function like that… what I did was created the functions in my code, and just passed Paramus to them from the Json schema.
A quick look … seems your code should work though. I haven’t touched VFG in a few months though, so don’t have a project handy to test on at the moment (switched jobs back in March).