Currently I have data table which has child rows as well , In child rows one of my column having the href link and I have the following onClick event to it.
File1.js
var empObj = {'name' : "Abc"};
var cell = row.insertCell(-1);
var hrefLink = document.createElement('a');
hrefLink.setAttribute('href',"#");
hrefLink.setAttribute('id',"all");
hrefLink.setAttribute('onClick',"window.open('/App/home/happyPath', '_blank', 'toolbar=yes,scrollbars=yes,resizable=yes,top=300,left=60,width=1100,height=650')");
hrefLink.innerHTML = "ALL";
cell.appendChild(hrefLink);
cell.style.textAlign = "center";
row.appendChild(cell);
In above code snippet its creating the href element and aim getting in the child rows and Also on click its opening new window with target html.
But its open the new window I'm laoding File2.js from thymleaf script tag <script th:src="@{/resources/build/js/File2.js(v=${startUpTime})}" />
Now here in File2.js I wanted to use the variable empObj from the File1.js for other data manipulation and computation.
Can anyone please help on this.
MainPage.html
<html>
<head>
<!-- <link rel="stylesheet" media="all"
th:href="@{/vendors/jquery/jquery.dataTables.min.css(v=${startUpTime})}" />
</head>
<body>
<div id="container">
This page will load the datable which having child rows with href link, code for loading the dataTable is implemented in the File1.js in dodcument ready method. </div>
<th layout:fragment="page-specific-js" th:remove="tag">
<script th:src="@{/resources/build/js/File1.js(v=${startUpTime})}" />
</th>
</body>
</html>
NewWindow.html
<html>
<head>
<!-- <link rel="stylesheet" media="all"
th:href="@{/vendors/jquery/jquery.dataTables.min.css(v=${startUpTime})}" />
</head>
<body>
<div id="container">
This page has to load the data form File2.js , But for this I reuiqred the object which is there in File1.js. , And If I declare File1.js in thus page then it will load DataTable of mainPage.html which actually not required. </div>
<th layout:fragment="page-specific-js" th:remove="tag">
<script th:src="@{/resources/build/js/File2.js(v=${startUpTime})}" />
</th>
</body>
</html>