PDA

View Full Version : How to Hide the Button in Docked Items of Grid?



Prasad_Guduri
2 Feb 2014, 11:09 PM
Hi All,

In a Grid panel i declared docked item as toolbar. The Tool bar has one button.

I want to hide the button based on the condition in OnStoreLister.

Following is the code:

_createDockedItemsConfig: function ()
{
return [{
xtype: 'rpessmytimecardactiontoolbar',
dock: 'bottom',
hideCertifyButton: true
}];
}



Ext.define('MyToolBar, {
extend: 'Ext.toolbar.Toolbar',
alias: 'widget.rpessmytimecardactiontoolbar',


initComponent: function ()
{
Ext.apply(this, this._createComponentConfig());
this.callParent();
},


_createComponentConfig: function ()
{
this._certifyButton = this._createCertifyButton();


return {
xtype: 'toolbar',
itemId: 'mytimecardActionToolbar',
items: [
this._certifyButton
]
};
},


_createCertifyButton: function ()
{
if (this.hideCertifyButton === true)
{
return undefined;
}


return new Ext.button.Button({
itemId: 'certifyBtn',
text: 'Certification',
disabled: false
});
}

});


Store Listener:

onXYZStoreLoad: function () {



var store = this.getPayPeriodCommentsStore();


var status = store.data.items[0].data.Status;

// Here i want to hide the button but im not able to access the button.


},

Refs i declared as following:

refs:[{ // for Certtification button
ref: 'certificationButton',
selector: 'mytimecardActionToolbar certifyBtn'
}]

How to access the certify button component and hide it.?

Thanks & Regards,
Prasad Guduri

palakurthivishal
2 Feb 2014, 11:31 PM
Hello Prasad,
Components with ItemIds are accessed with # mark before it.

refs:[{ // for Certtification button
ref: 'certificationButton',
selector: 'mytimecardActionToolbar #certifyBtn'
}]

Prasad_Guduri
2 Feb 2014, 11:37 PM
Thanks Vishal Ji...:)

palakurthivishal
5 Feb 2014, 5:41 AM
no problem... :)