Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

休日またぎのresizeを追加

  • Loading branch information...
commit 3f3f16dd093e5bde261f8ef74e622969be35c0fb 1 parent 0fafe9c
@mongorian-chop mongorian-chop authored
Showing with 18 additions and 5 deletions.
  1. +2 −2 example/index.html
  2. +16 −3 jquery.ganttView.js
View
4 example/index.html
@@ -14,7 +14,7 @@
</style>
<title>jQuery Gantt</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/flick/jquery-ui.css" media="screen" rel="stylesheet" type="text/css" />
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>
+ <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="../lib/date.js"></script>
<script type="text/javascript" src="../jquery.ganttView.js"></script>
@@ -41,7 +41,7 @@
$('<p>Edit task.</p>').dialog({modal: true})
},
change: function(o,s,m) {
- console.log(o.data('block-data').id);
+// console.log(o.data('block-data').id);
}
})
})
View
19 jquery.ganttView.js
@@ -237,10 +237,23 @@ var ChartLang = {
handles: 'e',
stop: function(event, ui) {
$(o).css("left", "").css("top", "").css("position", "")
- var rdistance = Math.ceil(ui.size.width / cellWidth)
- var rs = $(o).data('block-data').start.clone().addDays(rdistance)
- var re = $(o).data('block-data').end.clone().addDays(rdistance)
+ rdistance = Math.ceil(ui.size.width / cellWidth)
+ rs = $(o).data('block-data').start.clone().addDays(rdistance)
+ re = $(o).data('block-data').end.clone().addDays(rdistance)
console.debug('width: %o, originalSize: %o, day: %o', ui.size.width, ui.originalSize.width, rdistance)
+
+ adds = ui.size.width-ui.originalSize.width;
+ if(adds>0) {
+ odd = parseInt(adds/cellWidth)+1;
+ }else{
+ odd = parseInt(adds/cellWidth)-1;
+ }
+ newsize = $(o).data('block-data').size+odd;
+ re = DateUtils.resize($(o).data('block-data').start.clone(), newsize, cellWidth);
+ console.debug("cnt: %o, s %o, w: %o", newsize, re["start"], re["width"]);
+ $(o).data('block-data').size = newsize;
+ $(o).css("width", re["width"]);
+
change($(o), rs, rdistance)
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.