-
15 Apr 2012 7:58 AM #1
FieldSet before collapsed
FieldSet before collapsed
Hi , is that any equivalent event for before collapsed ?
i want to do something when i trigger the collapsed either expand or collapse
Thank you
-
15 Apr 2012 5:24 PM #2
Fieldset fires 'beforecollapse' event before it's collapsed.
-
16 Apr 2012 8:12 AM #3
Hi vietits,
i am aware of that but , when i put this to the listener it is not working , and i go through the documentation found out it is no longer there, thus i am look for equivalent thing to do that , do you have any idea ?
-
16 Apr 2012 3:34 PM #4
beforeexpand/beforecollapse events only available from Ext 4.1. There is no equivalent event on Ext 4.0. However, you can overrride Ext.form.Fieldset to fire those events:
Code:Ext.define('MyOverride.FieldSet', { override: 'Ext.form.FieldSet', setExpanded: function(expanded) { var me = this, operation = expanded ? 'expand' : 'collapse'; if (!me.rendered || me.fireEvent('before' + operation, me) !== false) { me.callOverridden(arguments); } } });
-
1 May 2012 5:41 AM #5
hi vietits,
thank you for your suggestion , but how do i implement this for different fieldset, for example i have 2 fieldset.
i try tou use your override , but some how it only targeted the last fieldset . i am not sure am i implement it in a wrong way . please advise .
-
1 May 2012 4:44 PM #6
This override will be applied to the prototype of Ext.form.FieldSet so it will has effect to all FieldSet instances.
-
2 May 2012 9:01 AM #7
My Code is something like above , somehow when i collapse or expand the fieldset for 'chkFieldType' it will display the alert, but when i try to collapse or expand 'chkvfieldService' the alert will not display.Code:Ext.onReady(function() { Ext.create('Ext.window.Window', { id : 'win', width: 500, height: 475, layout: 'fit', plain: true, border: false, items: [ Ext.create('Ext.form.Panel', { id:'frmViewDetail' items: [{ xtype: 'fieldset', id: 'chkvfieldService', title: 'Category', collapsible: true, items: [{ xtype: 'checkboxgroup', id: 'chkService', fieldLabel: 'Service', columns: 4, vertical: false }] },{ xtype: 'fieldset', id: 'chkFieldType', title: 'A', collapsible: true, items: [{ xtype: 'checkboxgroup', id: 'chkType', fieldLabel: 'Type', columns: 4, vertical: false }] } ] }] }) }) Ext.define('MyOverride.FieldSet', { override: 'Ext.form.FieldSet', setExpanded: function(expanded) { var me = this, operation = expanded ? 'expand' : 'collapse'; if (!me.rendered || me.fireEvent('before' + operation, me) !== false) { me.callOverridden(arguments); alert("Working") } } });
i try to debug it , it wont fire the override.
wondering am i putting the override function in a wrong place ?
-
2 May 2012 3:12 PM #8
The following code works well for me on Chrome 18 with both Ext 4.0.7 and Ext 4.1.0
Code:Ext.onReady(function(){ Ext.define('MyOverride.FieldSet', { override: 'Ext.form.FieldSet', setExpanded: function(expanded) { var me = this, operation = expanded ? 'expand' : 'collapse'; if (!me.rendered || me.fireEvent('before' + operation, me) !== false) { me.callOverridden(arguments); alert("Working") } } }); Ext.create('Ext.window.Window', { id : 'win', width: 500, height: 275, layout: 'fit', plain : true, autoShow: true, border: false, items: [Ext.create('Ext.form.Panel', { id: 'frmViewDetail', items: [{ xtype: 'fieldset', id: 'chkvfieldService', title: 'Category', collapsible: true, items: [{ xtype: 'checkboxgroup', id: 'chkService', fieldLabel: 'Service', columns: 4, vertical: false }] },{ xtype: 'fieldset', id: 'chkFieldType', title: 'A', collapsible: true, items: [{ xtype: 'checkboxgroup', id: 'chkType', fieldLabel: 'Type', columns: 4, vertical: false }] }] })] }); });


Reply With Quote