PDA

View Full Version : [SOLVED] How do I write this into a listener in the GripPanel configuration?



Elijah
16 Jun 2010, 11:26 AM
This works but other issues I have may be from this so i want to put it into a listener in the config.


argGridPanel.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
taskTpl.overwrite(
Ext.getCmp('gridPanelItemDetail' + argUniqueID).body, r.data
);
});



Below does not work.


argGridPanel = new Ext.grid.GridPanel({
...,
listeners: {
rowselect: function(sm, rowIdx, r) {
taskTpl.overwrite(
Ext.getCmp('gridPanelItemDetail' + argUniqueID).body, r.data
);
} // rowselect
}
})

Animal
16 Jun 2010, 11:46 AM
What are you asking? You have added a listener, so it can't be how to add a listener...

Elijah
16 Jun 2010, 12:10 PM
When i use the code portion at the very top and click on a row in the Grid Panel the event fires and the call to open the url fires.

When I try to use the listener code below it, nothing occurs. nothing shows up in fireBug like I did not click at all.

So I thought I am implementing the listener code incorrectly (i.e. wrong syntax or something)

Animal
16 Jun 2010, 12:17 PM
GridPanel does not have a rowselect event.

As you know. Because you have added a rowselect listener to the correct object above!

Elijah
16 Jun 2010, 1:22 PM
Right it does NOT.

Hence the question about getting this "argGridPanel.getSelectionModel().on('rowselect',..." to work on a listener in the gridPanel.


listeners: {
// this does fire but now I have no idea where my data went or how to get at it.
rowclick: function(argGrid, rowIdx, e) {....
} // rowclick
}
I could really use some direct syntax. Demo is suppose to be tommorow and the backend person still has not gotten me the code base I need and each time I get something from them it requires me to change stuff I have working but expecting different type of data.

Remember where I am working is a friggin hole in the ground where I do not have network connectivity. Had to get permission to work out of there this afternoon.

darthwes
16 Jun 2010, 2:41 PM
argGridPanel = new Ext.grid.GridPanel({
selModel: new Ext.grid.RowSelectionModel({
...,
listeners: {
rowselect: function(sm, rowIdx, r) {
taskTpl.overwrite(
Ext.getCmp('gridPanelItemDetail' + argUniqueID).body, r.data
);
} // rowselect
}
})
})

Elijah
17 Jun 2010, 4:44 AM
Thanks darthwes that code snippet was exactly what I needed to see.
I had also seen in some code sm: new Ext.gridRowSelectionModel....
Where is the main index listing that shows all these shorthands being still new to the library I can only poorly guess what it could be.

Hmm lets see sm:? sexy model, scary movie, secret method blah blah blah. Thanks again all for the responses.

darthwes
17 Jun 2010, 2:49 PM
Here is the main API documentation (http://www.sencha.com/deploy/dev/docs/).

sm is a shorthand for selModel. The only way I know this is I read the documentation for GridPanels about 400 times. Eventually stuff started sticking...

They don't have a listing of short hands that I know of, but when you look in the API at GridPanel's sm config attribute it says that it is an alias for selModel.

Elijah
21 Jun 2010, 5:16 AM
Direct Link to GridPanel :) http://www.sencha.com/deploy/dev/docs/?class=Ext.grid.GridPanel