View Full Version : Textlink in Grid -> New Window

12 Oct 2010, 1:07 AM

In my Ext.grid.GridPanel i display a textlink ("a href ...").
Now i want to open a new Ext.Window or Ext.Panel when the user is clicking on the textlink (label).

Thanks for your ideas.

12 Oct 2010, 1:30 AM
You do not need to use a hyperlink.

You will use the cellclick event, and perform your functionality in the handler.



12 Oct 2010, 4:40 AM
Hello animal.

thank you for your answer.

ok. your solution is working - but:
now the window is being shown on every click within the cell.

in the text i have 2 link-labels (a href).
isn't there a way to react on those clicks ?

12 Oct 2010, 4:46 AM
cellclick: function(grid, row, col, e) {
// check if col is correct
// next, check if e.getTarget() is on the element you want

12 Oct 2010, 4:59 AM
That's working.
Thank you conder !

12 Oct 2010, 5:47 AM
Does it work if you drag the columns into a different order?

12 Oct 2010, 6:01 AM
Indeed, don't rely on a fixed column index. Retrieve the column index from the column model using the id or dataIndex.

12 Oct 2010, 10:08 AM
You can create a renderer funcion that returns a '<a href="javascript:openExtWindow()">' for your column and create a javascript function to open the Ext.Window when user clicks on the link.

If you need, you can also pass some parameters to the function using record.data.nameOfYourColumn

13 Oct 2010, 12:02 AM
That is exactly NOT the way this should be done!

Using a cellclick listener creates lighter and more flexible code.