PDA

View Full Version : Add one more state event for columns.



extjs.mscit
7 Aug 2013, 8:00 AM
I want to add one more state event for column name "setFixValue", which is similar to filter.
All foreign key columns in grid, will fire this event.
there will be a combobox, which will load all vaule. For example UserId, will show combobox with UserName, and one can select it and hit "set" button, and "setClick" will save this value in State.

Everything is working fine, but how to add state event??

NOTE: on button click, I have object of "Ext.grid.column.Column" only. I do not want to fireevent from Grid. But from Column.
i.e very simillar way to "setSortState: function(state, skipClear, initial) {".

Where to add stateEvent name "setFixValue"??

Any idea.

Thanks in advance.

mitchellsimoens
11 Aug 2013, 4:17 PM
So you want to use the stateEvents config on the Column? Should be able to set it in the columns array config in the grid.

extjs.mscit
14 Aug 2013, 4:49 AM
Yes.

Please find my code below.


var provider = new Ext.state.Provider();
provider.on( "statechange", me.setDatabaseState );


These 2 lines are added to each grid page. It invoke {setDatabaseState} function on "columnResize", "columnShow", "columnHide", "sortChange" and save into database.

Now I want to add one more state event called "setfixvalue".

So when user click on "ok" button, i will fire event manually like below, and it shd invoke "stateChange" event


me.fireEvent('setfixvalue', me, header);
Please Help.

extjs.mscit
14 Aug 2013, 4:53 AM
Ext.define('Ext.ux.grid.FilterHeaderColumnModel',{

extend: 'Ext.grid.column.Column',

alias: 'widget.fixvaluecolumn',

// stateful: true,

stateEvents : 'setfixvalue'

});

I also tried to set stateful : true, but that does not make any difference

Note: i have used xtype: 'fixvaluecolumn' for each column config.