Commit 1534de8f authored by PkSM3's avatar PkSM3

[UPDATE] more details for dynatable

parent 00f13afc
......@@ -227,7 +227,7 @@ def projects(request):
project_type_id = cache.NodeType['Project'].id
date = datetime.datetime.now()
print(Logger.write("STATIC_ROOT"))
# print(Logger.write("STATIC_ROOT"))
projects = session.query(Node).filter(Node.user_id == user_id, Node.type_id == project_type_id).order_by(Node.date).all()
......
......@@ -20,7 +20,7 @@ th a:hover {
}
.dynatable-search {
float: right;
float: left;
margin-bottom: 10px;
}
......
......@@ -70,7 +70,8 @@ function Final_UpdateTable( action ) {
var UpdateTable = false
if ( (action == "click" && !isCollapsed) || (action=="changerange" && isCollapsed) ) {
UpdateTable = true;
}
$("#corpusdisplayer").html("Close Corpus")
} else $("#corpusdisplayer").html("Open Corpus")
pr("update table??: "+UpdateTable)
......@@ -220,7 +221,13 @@ function ulWriter(rowIndex, record, columns, cellWriter) {
}
// (3) Get records and metadata for paginator
$.ajax({
function Main() {
MyTable;
RecDict={};
AjaxRecords = []
Garbage = {}
$.ajax({
url: '/tests/paginator/corpus/'+corpusid,
success: function(data){
console.log(data)
......@@ -246,8 +253,9 @@ $.ajax({
.click(function(){
var ids2trash = []
for(var i in Garbage)
for(var i in Garbage) {
ids2trash.push(AjaxRecords[i].id);
}
console.log("ids to the trash:")
......@@ -406,12 +414,24 @@ $.ajax({
dc.renderAll();
// var newcontent = '<table id="my-ajax-table" class="table table-bordered">'
// newcontent += ' <thead>'
// newcontent += ' <th width="100px;" data-dynatable-column="date">Date</th>'
// newcontent += ' <th data-dynatable-column="name">Title</th>'
// newcontent += ' <th data-dynatable-column="del" data-dynatable-no-sort="true">Trash</th>'
// newcontent += ' </thead>'
// newcontent += ' <tbody>'
// newcontent += ' </tbody>'
// newcontent += '</table>'
// $('#my-ajax-table').html(newcontent)
MyTable = $('#my-ajax-table').dynatable({
dataset: {
records: data.records
},
features: {
pushState: false,
sort: false //i need to fix the sorting function... the current one just sucks
},
writers: {
......@@ -419,6 +439,14 @@ $.ajax({
// _cellWriter: customCellWriter
}
});
if ( $(".imadiv").length>0 ) return 1;
$('<br><br><div class="imadiv"></div>').insertAfter(".dynatable-per-page")
$(".dynatable-record-count").insertAfter(".imadiv")
$(".dynatable-pagination-links").insertAfter(".imadiv")
// console.log(RecDict)
}
});
});
}
Main();
......@@ -24,6 +24,22 @@
-o-transition: height 0.1s;
transition: height 0.1s;
}
th { color: #fff; }
th a {
color: #fff;
font-weight: normal;
font-style: italic;
font-size: 0.9em;
}
.dynatable-record-count {
font-size: 0.7em;
}
.dynatable-pagination-links {
font-size: 0.7em;
}
</style>
{% endblock %}
......@@ -86,22 +102,17 @@
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
<p onclick='Final_UpdateTable("click")' class="btn btn-primary btn-lg" align="right">Read documents</h2></p>
<p id="corpusdisplayer" onclick='Final_UpdateTable("click")' class="btn btn-primary btn-lg" style="width:200px; margin:0 auto; display:block;">Open Corpus</h2></p>
</a>
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse no-transition" role="tabpanel">
<div class="panel-body">
<p align="right">
<button id="move2trash" class="btn btn-primary btn-lg" >Move to trash!</button>
<!-- <p onclick='console.log("move to trash bitches")' class="btn btn-primary btn-lg" align="left">Move to Trash!</p> -->
</p>
<p align="right">
<table id="my-ajax-table" class="table table-bordered">
<thead>
<!-- <th data-dynatable-column="id">ID</th> -->
<th data-dynatable-column="date">Date</th>
<th width="100px;" data-dynatable-column="date">Date</th>
<th data-dynatable-column="name">Title</th>
<th data-dynatable-column="del" data-dynatable-no-sort="true">Trash</th>
</thead>
......@@ -109,6 +120,9 @@
</tbody>
</table>
</p>
<p align="right">
<button id="move2trash" class="btn btn-primary btn-lg" >Trash It!</button>
</p>
</div>
......@@ -163,7 +177,6 @@
</div>
</div>
<script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script>
<script src="{% static "js/charts/bootstrap.min.js" %}"></script>
<script type="text/javascript" src="{% static "js/jquery/jquery.dynatable.js" %}"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment