Angular Directive Live Search | DataTables with Child Rows

Angular Directive Live Search | DataTables with Child Rows

Angular Directive Live Search DataTables with Child Rows

In This article, I will tell you how to demonstrate points of interest data in youngster lines utilizing precise mandate and rakish data tables.We have prior post an article Angular Datatable Pagination, Sorting and Searching Using Ajax, Some circumstances we have to indicate subtle elements data of column and we are making another page to demonstrate a little detail data of parent push.

We can deal with this issue utilizing Guardian kid push component in data tables.I am utilizing precise data tables so I will make rakish order to indicate points of interest data of clicked parent push.

We will make essential custom mandate and pass our detail data protest it.The angular order is an exceptionally magnificent trap to include dynamic control or data a component.

In this Post We have given source code and in addition demo to indicate precise datatables parent tyke relationship utilizing rakish order.

Live Demo   Download Source Code

index.html

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"></script>
<script src="jquery.dataTables.min.js"></script>
<script src="angular-datatables.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="datatables.bootstrap.css">
<script src="app.js"></script>
<script src="directive.js"></script>
<style>
tr.shown a{
 color : red;
}
.green {
 color : green;
}
</style>
</head>
<body ng-app="TestApp" ng-controller="testController">
<div my-customer></div>
<div class="container">
<h1></h1>
  <table class="table table-striped" datatable="ng" dt-options="vm.dtOptions" dt-instance="vm.dtInstance">
   
	 <colgroup>
                    <col width="" />
					<col width="" />
                    <col width="" />
                    <col width="" />
                    <col width="" />
                  </colgroup>
                  <thead>
                    <tr>
                      <th></th>
                      <th width="260">Name</th>
                      <th width="160">Position</th>
					  <th width="160">Office</th>
                      <th width="70">Action</th>
                    </tr>
                  </thead>
    <tbody>
      <tr ng-repeat="user in userList">
        <td><a class="green shortinfo" href="javascript:;" ng-click="childInfo(user, $event)" title="Click to view more"><i class="glyphicon glyphicon-plus-sign"></a></td>
        <td>{{user.name}}</td>
        <td>{{user.position}}</td>
		<td>{{user.office}}</td>
		<td><div class="btn-group">
                <button type="button" class="btn btn-default btn" ng-click="edit($index);"><i class="glyphicon glyphicon-pencil"></i></button>  
                <button type="button" class="btn btn-default btn" ng-click="delete();"><i class="glyphicon glyphicon-trash"></i></button> 
                </div></td>
      </tr>
    </tbody>
  </table>
  
  </div>
</body>
</html>
<script>

</script>

child.html

<table class="table boderless">
	<tr>
		<th width="150">Salary :</th>
		<td>{{user.salary}}</td>
	</tr>
	<tr>
		<th>Start Date :</th>
		<td>{{user.start_date}}</td>
	</tr>
	<tr>
		<th>Ext :</th>
		<td>{{user.extn}}</td>
	</tr>	
</table>

directive.js

(function (window, angular, undefined) {
  'use strict';

  angular.module('TestApp')
  .directive('tmpl', testComp);
  
function testComp($compile){
  console.log('sss');
    var directive = {};
	
    directive.restrict = 'A';
    directive.templateUrl = 'app/view/_child.html'; 
    directive.transclude = true;   
    directive.link = function(scope, element, attrs){
      
    }
    return directive;
  }

})(window, window.angular);

 

You May Also Like

About the Author: admin

Leave a Reply

Your email address will not be published. Required fields are marked *