PDA

View Full Version : [Solved] GridPanel RowSelectionModel how do I use a on double click with this?



Elijah
7 Jul 2010, 8:15 AM
I am using the RowSelectionModel to detect when the user selects a row, but how exactly do i get it to detect a double click on that row?



selModel: new Ext.grid.RowSelectionModel ({
rowSelect: function(sm, rowIndex, r){
...
}
})

7 Jul 2010, 9:28 AM
i use rowdblclick event from the gridpanel

Elijah
7 Jul 2010, 7:49 PM
jgarcia thanks for the help but I cant get the syntax correct on this.


self.createGP = function(argCnfg){
fireBugLog(self.modName + ': createGP('+argCnfg.id+')');
// Create a new grid pane for displaying information
var tempGridPanel = new Ext.grid.GridPanel({
id:'tp' + argCnfg.id,
draggable: false,
stripeRows: true,
// associate a datastore to this grid panel
ds: argCnfg.dataStore,
border:true,
// Note: This could be constructed later on outside of here to make more dynamic
cm: new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
// Specify the dataIndex which maps to a field specified in the Ext.Data.Reader
{header: "ID", width: 45, sortable: true, dataIndex: 'id'},
{header: "Title", width: 275, sortable: true, dataIndex: 'title'}
]),
viewConfig: {
forceFit:true
},
selModel: new Ext.grid.RowSelectionModel({
singleSelect: true,
listeners: {
onRefresh: function(){
taskTpl.overwrite(
Ext.getCmp('gridPanelItemDetail' + argCnfg.id).body, 'Please select an item above to see additional details.'
);
},
rowselect: function(sm, rowIdx, r) {
// The value is always defined in here when trying to access grid.data.productURL
fireBugLog({sm: sm, rowIdx:rowIdx, r:r});
} // rowselect
} // listeners
}), //selModel
listeners:{
rowdblclick: function(grid, rowIdx, e) {
// The value is always undefined in here when trying to access grid.data.productURL.
fireBugLog({grid: grid, rowIdx:rowIdx, e:e});
} // rowselect
}
});

return tempGridPanel;
}; // createGPWould you please correct my syntax for this.

evant
7 Jul 2010, 7:57 PM
Your question doesn't really make sense, or you've omitted a bunch of info.

Why would there be some property on the grid called "data"?

Elijah
8 Jul 2010, 3:25 AM
Why are you asking me why ExtJS is the way it is?
I am also what part of my question is unclear. But to clarify more.

Currently I use rowselect to get the value associated to the row in the grid selected.
grid.data.MyDataStruct seems to get me my data when using the rowselect

Issue:
I want to change it to use the rowdblclick event instead.
When using the rowdblclick, it fails to get at the information so if someone would enlighten me as to the mystic syntax I am to use I would appreciate the assistance.

Condor
8 Jul 2010, 3:42 AM
What is grid.data.productURL?

You should be using something in the line of:

rowselect: function(selModel, rowIndex, record){
alert(record.get('id'));
}
...
rowdblclick: function(grid, rowIndex, event){
var record = grid.getStore().getAt(rowIndex);
alert(record.get('id'));
}

Chods
8 Jul 2010, 3:43 AM
The documentation is pretty good at describing what events are available and how to use them. Use rowDblClick on the grid as described.

BitPoet
8 Jul 2010, 4:46 AM
The documentation is pretty good at describing what events are available and how to use them. Use rowDblClick on the grid as described.

Please don't camelcase words that are meant to be all lowercase, like rowdblclick - Javascript is a case sensitive language after all.

Elijah
8 Jul 2010, 5:37 AM
What is grid.data.productURL?
You should be using something in the line of:


rowdblclick: function(grid, rowIndex, event){
var record = grid.getStore().getAt(rowIndex);
alert(record.get('id'));
}
Condor. Thank you. You have answered my question which was asking for the correct syntax to use.

Elijah
8 Jul 2010, 5:44 AM
You should be using something in the line of:
rowdblclick: function(grid, rowIndex, event){
var record = grid.getStore().getAt(rowIndex);
alert(record.get('id'));
}[/CODE]

Thank you Condor. The syntax is what I had been asking for.

Chods
8 Jul 2010, 7:19 AM
Does it annoy you.

rowDblClick
rowDblClick
rowDblClick
rowDblClick
rowDblClick
rowDblClick
rowDblClick

Elijah
8 Jul 2010, 10:07 AM
Thanks Condor. You provided me with exactly what I was asking for. The syntax.

You should be using something in the line of:


rowdblclick: function(grid, rowIndex, event){
var record = grid.getStore().getAt(rowIndex);
alert(record.get('id'));
}

Elijah
8 Jul 2010, 5:42 PM
Thanks condor this was exactly what i needed.


What is grid.data.productURL?

You should be using something in the line of:

rowselect: function(selModel, rowIndex, record){
alert(record.get('id'));
}
...
rowdblclick: function(grid, rowIndex, event){
var record = grid.getStore().getAt(rowIndex);
alert(record.get('id'));
}