PDA

View Full Version : addClass and onClick



Stripeman
15 Jul 2009, 5:55 AM
{
id: 'filter_inactive',
text: 'Inactive',
iconCls: 'details',
toggleGroup: 'filter',
enableToggle:true,
scope: this,
handler: function onItemClick(item, event) {

Ext.get('filter_inactive').removeClass('details');
Ext.get('filter_inactive').addClass('accept');
dataStore.on('beforeload', function() {
dataStore.baseParams = {
'table' : 'Members',
'ac' : 'showData',
'page' : 'adminMembers',
'filter' : 'In-Active'
};
});
dataStore.load();

}

}

What I am doing wrong?
Ext.get('filter_inactive').removeClass('details');
Ext.get('filter_inactive').addClass('accept');

Just does not work and no errors are returned.

Animal
15 Jul 2009, 6:08 AM
Define "not work"

You've stepped through it, and the Element with id "filter_inactive" does not have its class manipulated?

aconran
15 Jul 2009, 9:24 AM
You are removing the CSS class from the wrapping element around this component.

Take a look at what element in the markup the original iconCls 'details' is applied to. This is the element that you will want to remove the class from. You may also be interested in Ext.Element's replaceClass method.

Stripeman
15 Jul 2009, 10:29 PM
Define "not work"

You've stepped through it, and the Element with id "filter_inactive" does not have its class manipulated?

Thats correct. The before and after are the same lol

I am trying to make an indicator on the button clicked (glass green dot or something) and removing the iconCls from the others.

Stripeman
15 Jul 2009, 10:36 PM
You are removing the CSS class from the wrapping element around this component.
oh ? Because I thought that the Ext.getCmp() (or get() ) was giving the THE component. I am trying to manipulate the component directly. That component lies inside a xtype buttongroup do i need to start there?



Take a look at what element in the markup the original iconCls 'details' is applied to. This is the element that you will want to remove the class from.

Iam not sure if I am following. element in the markup the original is applied to? Im pretty sure you are not talkinga bout the css but the ID that I am trying to manipulte. (?) the element 'filter_inactive' is the element and I thought I was pointing the manipulation right to it.


You may also be interested in Ext.Element's replaceClass method.

I will look that up.

Stripeman
15 Jul 2009, 10:55 PM
This worked:
Ext.getCmp('filter_inactive').setIconClass('accept');

I dont understand why neither removeClass and replaceClass worked

BTW .. I am using 3.x



{
id: 'filter_inactive',
text: 'Inactive',
iconCls: 'details',
toggleGroup: 'filter',
enableToggle:true,
scope: this,
handler: function onItemClick(item, event) {

// This worked just fine...
Ext.getCmp('filter_inactive').setIconClass('accept'); //selected
Ext.getCmp('filter_none').setIconClass('details'); //not selected

dataStore.on('beforeload', function() {
dataStore.baseParams = {
'table' : 'Members',
'ac' : 'showData',
'page' : 'adminMembers',
'filter' : 'In-Active'
};
});
dataStore.load();

}

}

Stripeman
15 Jul 2009, 11:04 PM
question though.. can you please tell me where i can find a list of functions for "Ext.getCmp"? I did look in the doco and cant find it... it is possible i am blind...

steffenk
15 Jul 2009, 11:13 PM
http://extjs.com/deploy/dev/docs/?class=Ext

Stripeman
15 Jul 2009, 11:24 PM
http://extjs.com/deploy/dev/docs/?class=Ext

Thanks much Steffenk.. but as stated, I am looking for a list of functions for Ext.getCmp

IE:
Ext.getCmp(element).setIconClass() etc

steffenk
15 Jul 2009, 11:40 PM
what you get is Ext.Component which is described here
http://extjs.com/deploy/dev/docs/?class=Ext.Component

Stripeman
16 Jul 2009, 12:08 AM
But i still dont even see setIconClass. Am i to assume that it depends on the component being used? I mean if i sift though every component that I will find that function (and all other function possible) ?

steffenk
16 Jul 2009, 12:16 AM
sure. What you see in the docs are the properties/methods that are usable for all components. You also have the properties/methods of the specific component.