PDA

View Full Version : Dynamically chaning the URL in href



thangamalar
15 Jun 2010, 11:26 PM
Hi,

I am struggling to form the URL to open new page for every link in a grid row. Please find below my code and please get me out of this prison as I am trying to do this for the past 1/2 day. :((


renderer : function(value, metaData, record) {
var hv = record.get('HypervisorName');
var url = "http://somesite:9898/"+hv+".log";

//Use this hv to for the URL to open the specific HV link

return '<a href="pass above URL" target="_blank">syslog</a>';

}
How will I pass the URL aboe there? Thanks.

Animal
15 Jun 2010, 11:40 PM
Modify the Store, and the UI will be updated automatically.

thangamalar
15 Jun 2010, 11:50 PM
I dont know how to make the href for each store row. That's the problem I am having. This is my first project in Ext JS and hence can you please help me out with an example code?

Animal
16 Jun 2010, 12:50 AM
What don't you know exactly? I can't figure out what you don't know.

You saying you don't know how to concatenate strings?

thangamalar
16 Jun 2010, 12:51 AM
Finally I made it working like below.



return "<a href='" + url+ "' target='" + "_blank" + "'>syslog</a>";


But I don't know this is the right way using Ext JS.

Animal
16 Jun 2010, 12:53 AM
Nothing whatsoever to do with ExtJS is it now?

That's just writing a programming language.

thangamalar
16 Jun 2010, 12:53 AM
Modify the Store, and the UI will be updated automatically.

I was confused here how to modify the store to reflect with the URLs. Hence I asked. Sorry about that if I have confused you. I am new to this. Please let me know whether my solution I posted is right. Thanks for your help.

thangamalar
16 Jun 2010, 12:54 AM
Basicall I was looing for config option or APIs in ExtJS for passing URL params simple like how we do it in HttpProxy class. But clicking a link from grid cell and opening a browser window was little too much for me to manipulate.

Animal
16 Jun 2010, 1:06 AM
To modify the Store, you get the Record you want to change, and set the field you want to change in that Record.

The UI will then update itself.