We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
As a developer, I want to create a form view and only listen to changes of its "data" property, so that I can conveniently handle data changes.
This is especially useful for forms that autosave on data change and forms with dynamic fields.
Currently the "data" property is a cached derived property that will never emit any events. The documentation states otherwise:
https://www.npmjs.com/package/ampersand-form-view#properties
The following are FormView observables, thus emit "change" events: valid - the valid state of the form data - form field view values in { fieldName: value, fieldName2: value2 } format
The following are FormView observables, thus emit "change" events:
valid - the valid state of the form data - form field view values in { fieldName: value, fieldName2: value2 } format
Possible solution: Extend the update method to also trigger a "change" event passing the "data" property.
The text was updated successfully, but these errors were encountered:
change
A possible workaround until this feature is implemented:
'use strict'; var AmpersandFormView = require('ampersand-form-view'); /** * Form View * * @see https://github.com/AmpersandJS/ampersand-form-view/blob/v7.0.0/ampersand-form-view.js * @see https://github.com/AmpersandJS/ampersand-form-view/issues/69 */ module.exports = AmpersandFormView.extend({ /** * Monkey patch the update method to trigger "change" * events on the cached derived property "data". * * @param {string} field The form fields. */ update: function (field) { AmpersandFormView.prototype.update.call(this, field); this.trigger('change change:data', this.data); }, });
Sorry, something went wrong.
No branches or pull requests
As a developer, I want to create a form view and only listen to changes of its "data" property, so that I can conveniently handle data changes.
This is especially useful for forms that autosave on data change and forms with dynamic fields.
Currently the "data" property is a cached derived property that will never emit any events. The documentation states otherwise:
https://www.npmjs.com/package/ampersand-form-view#properties
Possible solution: Extend the update method to also trigger a "change" event passing the "data" property.
The text was updated successfully, but these errors were encountered: