开发者

Displaying Ext.Window buttons based on condition

I have a window like this.

function showDesignWindow(htmlData){

   var designWindow =  new Ext.Window({
        title: "E-Form Design",  
        width:650, 
        autoHeight: true,
        id:'designWindow',
        html: htmlData,
        closable: false,
        modal: true,
        y: 150,
        listeners: { 
            beforeclose: function () { 
                searchVisible = false;                      
            } 
        },
        buttons: [
                 { 
                     text: 'Add Control', handler: function() {
                  开发者_开发技巧      saveFormControl();
                     }
                 },
                 {
                     text:'Customize E-Form', handler: function() {                     
                        callCustomWindow();
                        designWindow.close();   
                     }
                 },
                 {
                     text:'Close', handler: function() {
                       designWindow.close();                        
                     }
                 }
                ]   
  });

   designWindow.show(this);

}

My Requirement Is I have to display the button 'Customize E-Form' only atleast one control added to the form. So How can i display the Ext.window button based on condition? Please suggest me...

Thanks in advance.

-sathya


Initialize the button as hidden and give it an itemId to reference it later:

{
    itemId: 'customize',
    text: 'Customize E-Form',
    hidden: true,
    handler: function() {
        callCustomWindow();
        designWindow.close();
    }
}

In the code you use to add items to your form you can with show the button with a call of:

designWindow.getFooterToolbar().get('customize').show();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜