-
5 Apr 2011 1:08 AM #1
Custom FormPanel buttons event or method not a function.
Custom FormPanel buttons event or method not a function.
FireBug error:
btns[i].setDisabled is not a function
btns[i].setDisabled(true);
Code:Ext.define('Jes.ux.FormPanel', { extend : 'Ext.form.FormPanel', requires: ['Jes.ux.Button'], alternateClassName : 'Jes.FormPanel', alias : 'widget.jform', method : null, hiddenStates : null, showStates : null, enableStates : null, disableStates : null, validation : false, border : true, bodyPadding : 10, url : null, initComponent : function() { Jes.ux.FormPanel.superclass.initComponent.apply(this, arguments); },// eo initComponent setState : function(method) { if (this.getForm().buttons) { var btns = this.getForm().buttons; Ext.each(btns, function(btn) { if (Ext.isObject(btn)) { btn.setDisabled(true); } }); } } });
-
5 Apr 2011 5:04 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,169
- Vote Rating
- 28
try this.fbar.items.each(function(btn) { btn.disable() }));
I have not tested this with ext 4, but it's along the correct lines.
Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
5 Apr 2011 11:23 PM #3
That code did not work
The sample code that does not work
but this worksCode:....................... ,buttons:[ {text:'Save',xtype:'jbutton',onSuccess:function(form,action) {panel1.setState('giris');panel1.disableFields(true);},method:'kaydet'}, {disableStates:'giris',text:'Delete',xtype:'jbutton',onSuccess:function(form,action){alert('silindi');},method:'sil',enableStates:'edit'} , {onClick:function(){this.up('jform').getForm().reset();panel1.disableButtons(false);panel1.setState('kaydet','last');},disableStates:'kaydet',text:'Cancel',xtype:'jbutton',enableStates:'edit'} ] ........................
I changed the code as follows:Code:,buttons:[ Ext.create('Jes.ux.Button',{text:'Save',xtype:'jbutton',onSuccess:function(form,action){panel1.setState('giris');panel1.disableFields(true);},method:'kaydet'}) , Ext.create('Jes.ux.Button',{disableStates:'giris',text:'Delete',xtype:'jbutton',onSuccess:function(form,action){alert('silindi');},method:'sil',enableStates:'edit'}) , Ext.create('Jes.ux.Button',{onClick:function(){this.up('jform').getForm().reset();panel1.disableButtons(false);panel1.setState('kaydet','last');},disableStates:'kaydet',text:'Cancel',xtype:'jbutton',enableStates:'edit'}) ]
problem is solved. thanksCode:............... setState : function(m, fld) { if (this.getForm().buttons) { var btns = this.getForm().buttons; Ext.each(btns, function(btn) { btn.changeState(m);//custom buttons method. }); } if (fld) { this.findField(fld).focus(true, 100); } }// eo setState ............
Similar Threads
-
extend class with custom method help
By edmeehan in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 30 Sep 2010, 10:06 PM -
is formpanel's 'render' method necessary after 'add' method??
By BlazeCrystal in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 22 Oct 2008, 1:40 AM -
Custom Buttons
By origin in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 11 Dec 2007, 10:08 PM -
Custom Ext.util.Format method
By josh in forum Ext 1.x: Help & DiscussionReplies: 1Last Post: 15 Oct 2007, 6:06 AM -
[1.1 Beta 1]: EditorGrid event, anonymous function is called, named function isn't?
By willydee in forum Ext 1.x: Help & DiscussionReplies: 6Last Post: 23 Jun 2007, 5:00 AM


Reply With Quote