jquery ui sortable 实现table,row的拖动。(Make Table Rows Sortable Using jQuery UI Sortable)

来源:互联网 发布:hadoop存入数据 编辑:程序博客网 时间:2024/04/28 04:49
// Return a helper with preserved width of cellsvar fixHelper = function(e, ui) {//console.log(ui)ui.children().each(function() {$(this).width($(this).width());//在拖动时,拖动行的cell(单元格)宽度会发生改变。在这里做了处理就没问题了});return ui;}; jQuery(function(){jQuery("#hrCalendar tbody").sortable({                //这里是talbe tbody,绑定 了sortablehelper: fixHelper,//调用fixHelperaxis:"y",start:function(e, ui){ui.helper.css({"background":"#fff"})     //拖动时的行,要用ui.helperreturn ui;},stop:function(e, ui){//ui.item.removeClass("ui-state-highlight"); //释放鼠标时,要用ui.item才是释放的行return ui;}}).disableSelection();})



参考:http://www.foliotek.com/devblog/make-table-rows-sortable-using-jquery-ui-sortable/




原创粉丝点击