Comments (4)
Awesome thanks!
from formengine.
Hi, @rainman400
I was wondering if there is functionality for triggering getForm in the FormBuilder component. For example, I want to update the component with form data based on external (to the component) searches. I want to ideally use my ui and api for this. But, once I have the data, I want to feed it to the component and have it render properly. The data is something that I get from the builderRef so it should ideally just plug and play, but I do not see a way to trigger this right now.
We didn't quite understand what you want. Can you please explain in more detail or show me with an example of the code how it should look?
Also, I was wondering if there is a way to hide the toolbar items
We will add this feature in the next release. Thereafter уou can hide specific parts of the interface using CSS selectors. As example:
.FormBuilder .Property > .CodeButton {
display: none;
}
from formengine.
Let me see if i can pseudo-code something out really quickly:
const [schema,setSchema] = useState<string>('') const getFromApi = (async () => { const apiSchema = await OnlineController.getSchema() setSchema(apiSchema); }) const getSchemaForBuilder = (() => { return schema || '' }) <FormBuilder getForm={getSchemaForBuilder} ...other props />
In this scenario, I want the formBuilder getForm to get triggered everytime 'getFromApi' is called, since it updates the schema variable. I am unsure of how to trigger that though.
For the moment, I have a workaround where I set a 'key' for the FormBuilder and remount it everytime I want to update the schema variable. It's not the worst solution, but maybe there is a better way?
from formengine.
@rainman400
There are several ways you can do this. In the code that you have shown, it is enough to add a useCallback:
const [schema,setSchema] = useState<string>('')
const getSchemaForBuilder = useCallback((formName?: string) => schema, [schema])
const getFromApi = (async () => {
const apiSchema = await OnlineController.getSchema()
setSchema(apiSchema)
})
return <FormBuilder getForm={getSchemaForBuilder} ...other props />
You can also update the schema directly through builderRef:
builderRef.current.parseForm(schema)
or through viewerRef.
viewerRef.current.loadForm(getSchemaForBuilder, name)
This is not a documented API yet, we will add documentation soon.
from formengine.
Related Issues (15)
- On production build Viewer faces an error that Anonymous components are not allowed! HOT 2
- Setting "valued" to an object type in a custom component HOT 5
- Crash when RsContainer doesn't exist "props" in the objet HOT 2
- form builder localization HOT 8
- onFormDataChange looping if there is setState inside HOT 5
- cannot add code actions from setting section HOT 14
- general loadCallback function on loadData options HOT 5
- Download JSON HOT 2
- Triggered custom download callback function HOT 2
- Customize builder UI HOT 2
- Issue Report: Updating Component Keys in Formengine React Library HOT 1
- Formbuilder clashes in i18n library/ dropdowns seem to render elsewhere HOT 5
- Form Builder (One to one) HOT 4
- Forms Tab is Not available? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formengine.