PDA

View Full Version : Single and Double click not working



sajan
21 Jun 2010, 12:14 AM
Hi all my grid is working now but still single and double click are not working.
As far as I know it should be working but it is not


MyPanel = Ext.extend(MyPanelUi, {
initComponent: function() {
MyPanel.superclass.initComponent.call(this);
var sm = this.grid.getSelectionModel();
sm.on('rowdblclick', this.onRowDblClick, this);
sm.on('rowclick', this.onRowClick, this);

},
onRowClick: function(sm, rowIdx, r)
{
Ext.MessageBox.alert('HI', 'I am single click');
//this.detail.update(r.data);
//ext.message
},

onRowDblClick: function(sm, rowIdx, r)
{
Ext.MessageBox.alert('Hello', 'I am double click');
}
});




my grid is editor grid panel.
Please helpo me if I am doing something wrong
thank you

jarrednicholls
21 Jun 2010, 3:22 AM
You are attaching your event handlers to the grid's SelectionModel. The SelectionModel does not handle click and dblclick events, only selection events. You can attach the rowclick and rowdblclick directly to the grid:



this.grid.on({
rowclick: this.onRowClick,
rowdblclick: this.onRowDblClick,
scope: this
});


Hope that helps!

sajan
21 Jun 2010, 3:42 AM
Sorry for my Ignorance but Since I am new to both it didn't work and I cant figure out the thing that is missing
can you help


MyPanel = Ext.extend(MyPanelUi, {
initComponent: function() {
MyPanel.superclass.initComponent.call(this);
this.grid.on({
rowclick: this.onRowClick,
rowdblclick: this.onRowDblClick,
scope: this
}),
onRowClick: function(sm, rowIdx, r)
{
Ext.MessageBox.alert('HI', 'I am single click');
},

onRowDblClick: function(sm, rowIdx, r)
{
Ext.MessageBox.alert('Hello', 'I am double click');
}}
});

thanks again

sajan
21 Jun 2010, 8:08 AM
Hi jarrednicholls,
I have got double click event working but after that both rowclick and row select stopped working :)).
I guess it might be me being stupid.
I saw (in exaples) a variable was used like "clicktoedit" or something like that but that didnt work for me.
A little help from you will be appreciated.

ps: and when will be get a tutorial? is is somewhere there in the corner cause it is getting tougher than i thought.
thanks

jarrednicholls
22 Jun 2010, 3:04 AM
There is an Getting Started guide on the Designer located here: http://www.sencha.com/products/designer/ExtDesignerGettingStarted.pdf

For Ext JS help, there are a lot of resources located in the Learning Center: http://www.sencha.com/learn/Main_Page

I can't see what might be wrong with your solution above...it looks fine, but there's not enough context for me to tell. If you could, paste in all of your code (.ui.js and .js) and I can diagnose the issue from there.

sajan
22 Jun 2010, 5:55 AM
Thank you jarrednicholls,
I have attached both the files that you have asked.

and there is also another problem if you can help
1. when i select a line on the grid, instead of selecting the whole row. it selects the column that i have clicked. I have wasted my entire day searching for the answer. If you can help then that would be great

thank you
Designer Rocks!!!

jarrednicholls
23 Jun 2010, 10:46 AM
Hi sajan,

The answer to your latest question is the EditorGridPanel's default SelectionModel is set to the CellSelectionModel. In the next release of the Designer you will be able to change the Grid's selection model, but in the meantime, you can set it manually in your implementation (.js) file, e.g.,



this.grid.selModel = new Ext.grid.RowSelectionModel();


I'll look at your project files and see if I can figure out what's going on. Thanks.