i have customer table in which i have column for customer name which is hyperlink. Now on click of hyperlink i am adding jquery tabs on the fly(thru ajax) which brings response(html + javascript) from server. As i click on customer1 hyperlink,its details are shown under Customer1 tab(Basically html reponse gets appended under Customer1 tab and also javascript associated with in that response also executed on browser).Similarly for customer 2. Issue is when i comeback to Customer1 Tab , Content shown is correct but javascript associated with Customer1 Tab response is not executed. This happens when use cache:true option.
var tabs = $("#myTabs").tabs({
tabTemplate: 'tabTemplate',
add: function (event, ui) {
/add specific logic
},
cache:true
});
If i use cache:false option, everything works like charm because each time response is coming from server and latest javascipt is execute and remains in browser context. But when i use cache:true() javasvcript associated with tab response is not executed (so what happens is javascripr that came from server lastly remains in browser context and creates issues .
For example if i do some operation on tab (i am coming back to), i don't get the javascript data associated with that specific tab response (instead i see the data associated with the tab for which last call was made to server).
In nutshell is there a way i can the make the javascript(associated with tab) to execute while using option cache as true?(so that right javascript can be put in browser context)
I am facing the issue with jquery tabs when going for cache. The scenario is this. I have got list of customers in table on my jsp page which has customer name has hyperLink. Say i clicked the customer 1 link, that record opens up in jquery tab i.e TAB1 with data loaded thru ajax call.Basically call goes to server side which returns back the CustomerView.jsp content and loaded in tab. CustomerView.jsp has form associated with it
and some javascript functions. Now i clicked the customer 2 link, CustomerView.jsp response is appended to TAB2. As long as i do any activity on that tab, everything works fine. But the moment the comes back to TAB1, javascript function corresponding 2 TAB2 is executed(Not the functions associated with TAB1). The reason i think is i am using jquery tabs with cache.Because of this javascript functions associated with last tab are on the top and when i come back to Tab1, Functions on the top are called.
This gets resolved as i don't cache the content. Is there a way where i can cache the previuos loaded tabs and functions associated with that tab are called?
Below is the code snippet in my jsp page which registers the tabs_div with jquery tab ,once the document is ready. Take note of tabTemplate property i am using.The purpose of it to assign the hyperlink value to tab at run time
below is the function which is being called on click of button. What happens is when i click this button, i want to add the new tab on my jsp page
function addTab(hitURL,title) { var tabs = $('#tabs_div').tabs(); tabs.tabs( "add", hitURL, currentTitle);//line 1 }
My question is how i can get values of variables hitURL,currentTitle passing thru line 1 at line 2. I was under impression whatever we pass as second argument (which is hitURL in this case ) will be populated automatically at line 2 in place of href.But its not happening.
I also tried declaring href as global variable and then modifying line 2 as below but it does not work.
In my legacy webapplication (using jquery,struts, java), i show the emails in grid(using datatable) where subject is one of the column under grid and values under it is hyperlink generated on the fly at server side.Right now, when i click on any subject hyperlink , its contents is shown (as hyperlink points to struts action class which process the request for that specific email id and forward to another jsp) on the same browser and return button is provided on that so that user once view the content, he can again return to inbox.
But now i want to open the hyperlink content in the new tab ,instead of showing the content on the same browser, similar to functionality on yahoo mail.Basically when i click on any email it should be opened in new tab and if i want i can close it too.I did bit of googling but could not spot the similar example wher hyperlink content is generated on fly under grid and it opens the content in new tab. Any pointer/Brief example would be a great help.