可拖拽调整
This commit is contained in:
parent
3b55e9e39b
commit
308f247c71
|
@ -1,5 +1,5 @@
|
|||
<table class="hwork-table-wrap" id="homework_table" onmouseenter="resizeable_table(3,4,11,11)">
|
||||
<tr class="b_grey hworkH30" style="border-bottom:1px solid #eaeaea;">
|
||||
<tr class="b_grey hworkH30">
|
||||
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
|
||||
<th class="hworkList50"> </th>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<table class="hwork-table-wrap">
|
||||
<tr class="b_grey hworkH30" style="border-bottom:1px solid #eaeaea;">
|
||||
<table class="hwork-table-wrap" id="homework_table" onmouseenter="<%= @homework.homework_type == 3 ? '' : 'resizeable_table(2,4,11,11)' %>">
|
||||
<tr class="b_grey hworkH30">
|
||||
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
|
||||
<th class="hworkList50"> </th>
|
||||
<% if @homework.homework_type != 3 %>
|
||||
<th class="<%= @homework.homework_type == 2 ? 'hworkList80 pr10' : 'hworkList130 pr10'%>" style="text-align:left;">作品名称</th>
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> pr10">
|
||||
<th class="<%= @homework.homework_type == 2 ? 'hworkList80 pr10 hide-text' : 'hworkList130 pr10 hide-text'%>" style="text-align:left;">作品名称</th>
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> pr10 hide-text">
|
||||
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl #{@homework.anonymous_comment == 1 ? 'ml35' : 'ml18'}" ,:remote => true%>
|
||||
<% if @show_all && @order == "lastname"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
|
||||
<% end%>
|
||||
</th>
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList90' : 'hworkList80'%> pr10">
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList90' : 'hworkList80'%> pr10 hide-text">
|
||||
<%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb fl ml30" ,:remote => true%>
|
||||
<% if @show_all && @order == "student_id"%>
|
||||
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'st_up' : 'st_down'} mt10" ,:remote => true%>
|
||||
|
@ -18,7 +18,7 @@
|
|||
</th>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
|
||||
<th class="hworkList130 pr10" style="text-align:left;">作品名称</th>
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList220' : 'hworkList160'%>">
|
||||
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList210' : 'hworkList160'%>">
|
||||
<span class="c_dark f14 fb">关联项目</span>
|
||||
</th>
|
||||
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
|
||||
</div>
|
||||
</td>
|
||||
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10 student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
|
||||
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
|
||||
<%= student_work.user.show_name%>
|
||||
</td>
|
||||
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStID90' : 'hworkStID'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
|
||||
|
|
|
@ -2,6 +2,12 @@
|
|||
* Created by ttang on 2016/5/24.
|
||||
*/
|
||||
$(document).ready(function(){
|
||||
window.onload = function(){
|
||||
$("th").each(function(){
|
||||
$(this).css("width",$(this).width()-1);
|
||||
});
|
||||
}
|
||||
|
||||
resizeable_table = function(colS,colE,p1,p2){
|
||||
var headerTds = document.getElementById("homework_table").rows[0].cells;
|
||||
var mousedown = false;
|
||||
|
@ -34,20 +40,13 @@
|
|||
if (mousedown == true){
|
||||
var width = (tdWidth + (evt.screenX - screenXStart)) - p1 + "px";//计算后的新的宽度
|
||||
var width2 = (tdWidth2 - (evt.screenX - screenXStart)) - p2 + "px";
|
||||
console.log(width, width2, totalWidth);
|
||||
if (parseInt(width)<0 || parseInt(width2)<58 || tdWidth > totalWidth || tdWidth2 > totalWidth){
|
||||
if (parseInt(width)<0 || parseInt(width2)<0 || tdWidth > totalWidth || tdWidth2 > totalWidth){
|
||||
tartgetTd = null;
|
||||
resizeable = false;
|
||||
mousedown = false;
|
||||
}else{
|
||||
targetTd.style.width = width;
|
||||
targetTd.nextElementSibling.style.width = width2;
|
||||
document.onmouseup = function(event){
|
||||
tartgetTd = null;
|
||||
resizeable = false;
|
||||
mousedown = false;
|
||||
document.body.style.cursor='default';
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var trObj = tblObj.rows[0];
|
||||
|
@ -57,11 +56,12 @@
|
|||
srcObj.style.cursor='col-resize';//修改光标样式
|
||||
}else{
|
||||
resizeable = false;
|
||||
mousedown = false;
|
||||
srcObj.style.cursor='default';
|
||||
}
|
||||
}
|
||||
}
|
||||
document.onmouseup = function(event){
|
||||
document.body.onmouseup = function(event){
|
||||
tartgetTd = null;
|
||||
resizeable = false;
|
||||
mousedown = false;
|
||||
|
|
Loading…
Reference in New Issue