I'm creating a FormDialog class, subclassing isc.Window. It's body should contain two components: a form and a button. I'm trying to use auto children. I now have this:
Questions I have is:
- Is the items array correct? Or can I have these auto children created differently (I've tried "addAsChild" in the formDefaults and saveButtonDefaults, but this didn't work)
- Do I need the initWidget code so that I can pass the data source of the dialog itself to the "form" auto child?
- Will the items be destroyed correctly when the dialog itself is destroyed?
Code:
isc.defineClass('FormDialog', isc.Window).addProperties({ formConstructor: null, // should be set when instantiating the dialog formDefaults: { autoParent: 'none', width: '100%' }, saveButtonConstructor: 'Button', saveButtonDefaults: { autoParent: 'none', // submits the form click: function () { this.creator.form.submit(); }, title: 'Save', width: '100%' }, initWidget: function () { // is it possible to "set" this differently? this.addAutoChild('form', { dataSource: this.dataSource }); this.Super('initWidget', arguments); }, items: ['autoChild:form', 'autoChild:saveButton'], ... }); var dialog = isc.FormDialog.create({ formConstructor: 'CustomerForm', dataSource: isc.CustomersDataSource.create() });
- Is the items array correct? Or can I have these auto children created differently (I've tried "addAsChild" in the formDefaults and saveButtonDefaults, but this didn't work)
- Do I need the initWidget code so that I can pass the data source of the dialog itself to the "form" auto child?
- Will the items be destroyed correctly when the dialog itself is destroyed?
Comment