Open philfreo opened 11 years ago
I'd really prefer it if I could insert or remove fields with methods, which essentially calls createField internally and append or remove from the container. Rerendering is a no go on mobile. I don't thinks people would want the screen to be jumping around, losing focus to field but the keyboard is still hanging around etc as soon as I've picked a value from a select box.
The way I do it currently is to override the Form#render method and #initialize to listen to couple of key change events, the resulting code is quite nasty.
Let's move discussion about this use case back to #273.
I opened this issue for other use cases where you plan on re-rendering the form anyway (when it's not currently visible) but want to update the schema first.
Current workaround in the case where you want to take an existing form instance, tweak the schema, and re-display it:
form.schema = _.result(this.model, 'schema'); // or whatever
form.initialize();
form.render();
I'm not sure if calling initialize
a 2nd time is OK. If so, this ticket can probably be closed. If not, then we should have a helper method that sets this.fields
, this.fieldsets
, etc. automatically.
Hi! Has anyone found an answer to this problem ?
form.initialize(); works fine
I've needed to dynamically change a form schema and then re-render the form.
Right now you can say:
form.schema = newSchema
but then
form.fieldsets
,form.selectedFields
, etc. get out-of-date and have to also be re-set manually.I'd propose adding a
setSchema
helper method toForm
to make this nicer.