Skip to content

Commit

Permalink
version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
opendatatable committed Nov 20, 2017
1 parent e766b3b commit ef4dcb5
Show file tree
Hide file tree
Showing 9 changed files with 270 additions and 42 deletions.
50 changes: 30 additions & 20 deletions CodeIgniter/assets/js/OpenDataTable.js
Expand Up @@ -27,11 +27,11 @@
*
* @package Open DataTable
* @author Open DataTable Team
* @copyright Copyright (c) 2007,Open DataTable (http://opendatatable.com/)
* @copyright Copyright (c) 2017,Open DataTable (http://opendatatable.com/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://opendatatable.com/
* @since Version 1.0.0
* @version 1.0.2
* @version 1.0.3
* @filesource
*/

Expand All @@ -49,7 +49,14 @@

(function($)
{

$.fn.ODTDestroy=function (option)
{
var tl=$(this);
tl.prev('.odt-top').remove();
tl.next('.odt-pagination-container').remove();
tl.find('tbody').empty();
}

//Fetch Data//
function FetchData(tl,allSettings)
{
Expand Down Expand Up @@ -161,8 +168,8 @@
var btn="";
if(ClikedBtn=='null')
{
btn+="<li href='#' class='disable'><<</a></li>";
btn+="<li href='#' class='disable' >>></a>";
btn+="<li href='#' class='disable'><a><<</a></li>";
btn+="<li href='#' class='disable' ><a>>></a>";
}
else
{
Expand Down Expand Up @@ -200,23 +207,23 @@

if(ClikedBtn==0 || prvBtn==0)
{
btn+="<li href='#' class='disable'><<</a></li>";
btn+="<li class='disable disabled'><a href='#'> <<</a></li>";
}
else
{
btn+="<li href='#' class='odt_Pbtn' data-count='"+prvBtn+"' ><<</a></li>";
btn+="<li class='odt_Pbtn' data-count='"+prvBtn+"' ><a href='#'> <<</a></li>";
}


for(var st=Start;st<=Stop;st++)
{
if(st==ClikedBtn)
{
btn+="<li href='#' class='odt_Pbtn active' data-count='"+st+"' >"+st+"</a></li>";
btn+="<li class='odt_Pbtn active' data-count='"+st+"' ><a href='#'>"+st+"</a></li>";
}
else
{
btn+="<li href='#' class='odt_Pbtn' data-count='"+st+"' >"+st+"</a></li>";
btn+="<li class='odt_Pbtn' data-count='"+st+"' ><a href='#'>"+st+"</a></li>";
}
c++;
}
Expand All @@ -226,11 +233,11 @@

if(ClikedBtn>=allSettings[1])
{
btn+="<li href='#' class='disable' >>></a>";
btn+="<li class='disable disabled' ><a href='#'> >></a></li>";
}
else
{
btn+="<li href='#' class='odt_Pbtn' data-count='"+nxtBtn+"' >>></a></li>";
btn+="<li class='odt_Pbtn' data-count='"+nxtBtn+"' ><a href='#'> >></a></li>";
}
}
//btn+="</ul>";
Expand All @@ -254,6 +261,9 @@
});
}




//Pagination END//

$.fn.OpenDataTable=function (option)
Expand Down Expand Up @@ -291,22 +301,22 @@
tl.addClass('odt-main');

var TopHtml=
'<div class="odt-top"><div class="odt-display-record" style="'+display_no_of_rec+'" >'+
'<div class="odt-top"><div class="odt-display-record pull-left" style="'+display_no_of_rec+'" >'+
'Display '+
'<select id="odt-rec-per-page">'+
'<select id="odt-rec-per-page form-control">'+
'<option value="10">10</option>'+
'<option value="25">25</option>'+
'<option value="50">50</option>'+
'<option value="100">100</option>'+
'</select>'+
' records '+
'</div>'+
'<div class="odt-main-search" style="'+display_search+'" >Search : <input type="search" id="search" class="odt-search"></div></div>';
'<div class="odt-main-search pull-right" style="'+display_search+'" ><input type="search" placeholder="Search" id="search" class="odt-search form-control"></div></div>';

var bottomHtml='<div class="odt-pagination-container">'+
'<div class="odt-show-entry"></div>'+
'<div class="odt-show-entry pull-left"></div>'+
'<div class="odt-pagination">'+
'<ul class="pagination"></ul>'+
'<ul class="pagination pull-right"></ul>'+
'</div>'+
'</div>';

Expand Down Expand Up @@ -336,8 +346,8 @@
{


var customHtml='<div class="odt-col" data-colno='+key+' >'+$(this).text()+'</div>';
customHtml+='<div class="odt-arrow">';
var customHtml='<div class="odt-col pull-left" data-colno='+key+' >'+$(this).text()+'</div>';
customHtml+='<div class="odt-arrow pull-right">';
if(setting_sort_type=="ASC" && parseInt(setting_sort_col)==key)
{
customHtml+='<span class="up-arrow"></span>';
Expand Down Expand Up @@ -375,7 +385,7 @@

if($.inArray(i, colSearchData) !== -1)
{
htmlColSearch+='<input type="text" class="odt-colSearch" data-colindex='+i+'></td>';
htmlColSearch+='<input type="text" class="odt-colSearch form-control" data-colindex='+i+'></td>';
countS++;
}
else{
Expand Down Expand Up @@ -482,7 +492,7 @@
FetchData(tl,tl.allSettings);
});

tl.find('thead').find('tr').find('th').click(function(event)
tl.find('thead').find('tr').find('th').unbind().click(function(event)
{


Expand Down
112 changes: 112 additions & 0 deletions destroy/index.html
@@ -0,0 +1,112 @@
<html>
<head>
<title>Open DataTable Simle Example</title>
<meta name="description" content="Open DataTable is a JQuery plug-in. It is fast, very much realiable, easy to implement, highly flexible and comes with a very beautiful UI.It is currently avaiblable only with PHP MySQL data source and under development for supporting other data sources in near future">
<meta name="keyword" content="JQuery data table, Php data table, simple data table">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<!-- <script src="https://code.jquery.com/jquery-2.2.4.js"></script> -->
<script src="../js/jquery-2.0.3.min.js"></script>

<link rel="stylesheet" type="text/css" href="../css/style.css">
<script src="../js/OpenDataTable.js"></script>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<script type="text/javascript" src="../js/prism.js"></script>
<link href="../css/prism.css" rel="stylesheet">
<script type="text/javascript">
$(document).ready(function(){
$(".OpenDataTable").OpenDataTable({
url:"../source/simple_php_datasource.php",
});
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-98093724-1', 'auto');
ga('send', 'pageview');

</script>
</head>
<body>
<h1 class="logo"> <a href="http://opendatatable.com/"> <span class="logo1">Open</span> DataTable</a></h1>
<h2>Simple Example</h2>
<p><b>Required files</b><br>
<a href="https://code.jquery.com/jquery-2.2.4.js">jquery-2.2.4.js</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/source/simple_php_datasource.php">simple_php_datasource.php</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/css/style.css">style.css</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/js/OpenDataTable.js">OpenDataTable.js</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/country_city.sql">country_city.sql</a><br>
</p>
<b>Code</b> <br>
some time we required to distroy the data to load new data for that perpose call this function where you want to laod a new data.<b><code class="language-JavaScript"> $(".OpenDataTable").ODTDestroy();</code> </b>
<pre class="language-markup">
<code class="language-markup">
&lt;html>
&lt;head>
&lt;title>Open Data Table&lt;/title>
&lt;script src="https://code.jquery.com/jquery-2.2.4.js">&lt;/script>
&lt;link rel="stylesheet" type="text/css" href="style.css">
&lt;script src="OpenDataTable.js">&lt;/script>
&lt;script type="text/javascript">
$(document).ready(function(){
$(".OpenDataTable").OpenDataTable({
url:"simple_php_datasource.php",
});
});
&lt;/script>
&lt;/head>
&lt;body>
&lt;a href="#" class="link">click here to destroy table&lt;/a>
&lt;table class="OpenDataTable">
&lt;thead>
&lt;tr>
&lt;th>Code&lt;/th>
&lt;th>Name&lt;/th>
&lt;th>Continent&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>&lt;/tbody>
&lt;/table>
&lt;script type="text/javascript">
$('.link').click(function(){
$(".OpenDataTable").ODTDestroy();
$(".OpenDataTable").OpenDataTable({
url:"../source/simple_php_datasource.php",
})
});
&lt;/script>
&lt;/body>
&lt;/html>


</code></pre>
<p><b>Output</b></p>

<a href="#" class="link">click here to destroy table</a>
<table class="OpenDataTable">
<thead>
<tr>
<th>Code</th>
<th>Name</th>
<th>Continent</th>
</tr>
</thead>
<tbody></tbody>
</table>
<script type="text/javascript">
$('.link').click(function(){
$(".OpenDataTable").ODTDestroy();

$(".OpenDataTable").OpenDataTable({
url:"../source/simple_php_datasource.php",
});
});

</script>

</body>
</html>
90 changes: 90 additions & 0 deletions hide-col/index.html
@@ -0,0 +1,90 @@
<html>
<head>
<title>Open DataTable Hide Colume</title>
<meta name="description" content="Open DataTable is a JQuery plug-in. It is fast, very much realiable, easy to implement, highly flexible and comes with a very beautiful UI.It is currently avaiblable only with PHP MySQL data source and under development for supporting other data sources in near future">
<meta name="keyword" content="JQuery data table, Php data table, simple data table">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />

<!-- <script src="https://code.jquery.com/jquery-2.2.4.js"></script> -->
<script src="../js/jquery-2.0.3.min.js"></script>

<link rel="stylesheet" type="text/css" href="../css/style.css">
<script src="../js/OpenDataTable.js"></script>
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
<script type="text/javascript" src="../js/prism.js"></script>
<link href="../css/prism.css" rel="stylesheet">
<script type="text/javascript">
$(document).ready(function(){
$(".OpenDataTable").OpenDataTable({
url:"../source/simple_php_datasource.php",
});
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-98093724-1', 'auto');
ga('send', 'pageview');

</script>
</head>
<body>
<h1 class="logo"> <a href="http://opendatatable.com/"> <span class="logo1">Open</span> DataTable</a></h1>
<h2>Hide Colume Example</h2>
<p><b>Required files</b><br>
<a href="https://code.jquery.com/jquery-2.2.4.js">jquery-2.2.4.js</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/source/simple_php_datasource.php">simple_php_datasource.php</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/css/style.css">style.css</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/js/OpenDataTable.js">OpenDataTable.js</a><br>
<a href="https://github.com/opendatatable/OpenDataTable/blob/master/country_city.sql">country_city.sql</a><br>
</p>
<b>Code</b><br>
Simply add <b><code class="language-JavaScript"> data-colhide="yes"</code></b> to <th> hide any column
<pre class="language-markup">
<code class="language-markup">
&lt;html>
&lt;head>
&lt;title>Open Data Table&lt;/title>
&lt;script src="https://code.jquery.com/jquery-2.2.4.js">&lt;/script>
&lt;link rel="stylesheet" type="text/css" href="style.css">
&lt;script src="OpenDataTable.js">&lt;/script>
&lt;script type="text/javascript">
$(document).ready(function(){
$(".OpenDataTable").OpenDataTable({
url:"simple_php_datasource.php",
});
});
&lt;/script>
&lt;/head>
&lt;body>
&lt;table class="OpenDataTable">
&lt;thead>
&lt;tr>
&lt;th data-colhide="yes" >Code&lt;/th>
&lt;th>Name&lt;/th>
&lt;th>Continent&lt;/th>
&lt;/tr>
&lt;/thead>
&lt;tbody>&lt;/tbody>
&lt;/table>
&lt;/body>
&lt;/html>


</code></pre>
<p><b>Output</b></p>
<table class="OpenDataTable">
<thead>
<tr>
<th data-colhide="yes" >Code</th>
<th>Name</th>
<th>Continent</th>
</tr>
</thead>
<tbody></tbody>
</table>
</body>
</html>

0 comments on commit ef4dcb5

Please sign in to comment.