How to popup static HTML table content with 8 columns of fields in service portal

sinu2
Tera Expert

Hi, 

I am née for service portal. My requirement is to when onclick of a button popup a static HTML table with some content. If any one has done like this requirement earlier can provide me code or what needs to be config? 

1 ACCEPTED SOLUTION

Try This,

HTML Script:

<div>
<style>
. >div {
height: 15em;
width: 19em;
padding: 0.5em 1em;
margin: 0 0em 1em 0;
background-color: #fff;
color: #00385a;
}

. div li {
list-style-image: url('potato-bullet.png');
}

. div>div {
height: 95%;
background-image: url('');
background-repeat: no-repeat;
background-position: top right;
}
</style>
<a class="" href="">
    <ul ng-if="::c.options.bulletList">
      <li ng-repeat="b in ::c.options.bulletList"></li>
		</ul>
</a>
</div>
<div>
 <button class="btn btn-primary" ng-click="c.openModal()">${Open Modal}</button>
</div>
 
<script type="text/ng-template" id="modalTemplate">
 <div class="panel panel-default">
	 <div class="panel-heading">
		 <h4 class="panel-title">Modal Window</h4>
   </div>
   <div class="panel-body wrapper-xl">
       
     <table class="table table-striped table-bordered">
      <h2>Table data</h2>
     
        <tr>
          <th scope="col">Column 1</th>
          <th scope="col">Column 2</th>
          <th scope="col">Column 3</th>
        </tr>
         <tr>
          <td scope="col">data 1</td>
          <td scope="col">data 2</td>
          <td scope="col">data 3</td>
        </tr>
         <tr>
          <td scope="col">data 1</td>
          <td scope="col">data 2</td>
          <td scope="col">data 3</td>
        </tr>
     		
      </table>
       
   </div>
 	 <div class="panel-footer text-right">
   <button class="btn btn-primary" ng-click="c.closeModal()">${Close Modal}</button>
 </div>
 </div>
</script>

 

Client Script:

function($uibModal, $scope) {
/* widget controller */
var c = this;
c.options.cssClassName = "lw-tile-" + c.options.cssClassName;
 c.openModal = function() {
 c.modalInstance = $uibModal.open({
 templateUrl: 'modalTemplate',
 scope: $scope
 });
 }
 
 c.closeModal = function() {
 c.modalInstance.close();
 }
}


Let me know if it work's

View solution in original post

41 REPLIES 41

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


For testing i create something like that:

HTML CODE:

<div>
<!-- your widget template -->
<form class="large-margin-bottom col-xs-offset-3 col-xs-6">
<div class="form-group">
<label for="Name Text">${Full Name}:</label>
<input class="input-lg form-control" type="text" ng-model= "c.data.fullName" placeholder="Enter Employee Name" >
</div>

<button type="submit" ng-click="c.send_fullName(c.data.fullName);"class="btn btn-primary btn-lg btn-block">
<i ng-if="c.data.loading" class="fa fa-spinner fa-spin m-r-sm"></i>${Search}
</button>
</form>


<div ng-if= "!c.data.loading && c.data.json.length>0">
<table class="table table-striped table-bordered">
<caption>List of actions for this Employee</caption>
<thead class="thead-light">
<tr>
<th scope="col">Employee Name</th>
<th scope="col">Occupation</th>
<th scope="col">Location</th>
<th scope="col">Start Date</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="item in data.json">
<td>{{item}}</td>
<td>{{item}}</td>
<td>{{item}}</td>
<td>{{item}}</td>

</tr>
</tbody>
</table>
</div>

 

CLIENT CONTROLLER:

function() {
/* widget controller */
var c = this;

//Name send to server
c.send_fullName = function(test) {
c.data.loading = true;
c.data.action = "addName";
c.data.loading = false;
c.server.update().then(function() {
c.data.action = undefined;
c.data.fullName = '';
})
}
}

 

SERVER SIDE:

(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.fullName = '';
data.showTable = '';
data.json = [];

if (input && input.action == 'addName') {
data.fullName = input.fullName;
var subject_person = 'Ashutosh';
//fetchHR(data.fullName);
data.json = ['a','b','c','d','e','g'];
//getEmployeeData(data.fullName);

}
})();

 

OUTPUT:

find_real_file.png

Please change it as per your requirement.

Thanks,
Ashutosh

Hi Ashutosh, Thank you so much for your quick response...this really 90 percent near to my requirement.... 😍 But small query in my requirement there will not be any search field just it would be an clickable button. For example I need a button called abc in one of my widget as soon as user clicks that abc button the below table should show with the hard coded data. Could you kindly suggest what needs to be change in the below script.... Note.. There will not be any dynamic values.... All the html table is a static

Since it should show static values do we require server code.... Kindly see the attached table exactly that same table same data I should show when I click abc link or button

Ashutaosh, exactly the same table the same data I need to show when I click abc link or button. Kindly help