How can gantt drag(X、Y) and output data

117 views
Skip to first unread message

Roy Lin

unread,
Sep 4, 2013, 5:46:16 AM9/4/13
to jquer...@googlegroups.com
I try add the drag function ,but I can not to change the source value.

And I want to output the data , how can I do?


the code is in index.html file
onRender: function() {
                    $('.ganttRed').draggable(
                        {
                            //axis:'x',
                            start: function(event, ui) {
                                $(this).data("startx",$(this).offset().left);
                                $(this).data("starty",$(this).offset().top);   
                            },
                            stop: function(event, ui) {
                                var change = $(this).offset().left - $(this).data("startx");
                                var change1 = $(this).offset().top - $(this).data("starty");
                                //var change1 = $(this).offset().top;
                                var value = $(this).css('margin-left');
                                var value1 = $(this).css('margin-top');
                                value = value.split("px");
                                value = parseInt(value[0]) + change;                            
                                value1 = value1.split("px");
                                value1 = parseInt(value1[0]) + change1;                           
                                if(value1%24<2 )
                                {
                                    value1=value1+(2-(value1%24));
                                }
                                else if(value1%24>2)
                                {
                                    value1=value1-(value1%24-2);
                                }
                                $(this).css('margin-left', value);
                                $(this).css('left', '');
                                $(this).css('margin-top', value1);
                                $(this).css('top', '');
                            }                   
                        }
                    );




Reply all
Reply to author
Forward
0 new messages