easyUI中draggable怎么用-创新互联
这篇文章主要介绍easyUI中draggable怎么用,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

示例:
- 品类
- 工厂
- 跟高
- 跟型
- 单价
级联统计指标
列指标
-------------以下为js代码
var tab = [];
$('.items li').draggable({
proxy: 'clone',
revert: true
});
// 级联统计指标放置区
$('.target-cascade').droppable({
onDragEnter: function(e,source){
$(this).css('border','1px solid red');
},
onDragLeave: function(e,source){
$(this).css('border','1px solid black');
},
onDrop: function(e,source){
// 判断拖动的元素是否存在于放置区内
if($(source).draggable('options').proxy === 'clone'){
// 禁用拖动
NotDrag(source);
// 将拖入元素的原位置记录下来
var buttonName = $(source).find('span').html();
console.log("--------"+$(source).index());
tab[buttonName] = $(source).index();//返回指定元素相对于其他元素的位置(0,1等),如果没有找到,则返回-1
var Ele = $('');
Ele.appendTo('.target-cascade ul');
}
$(this).css('border','1px solid black');
// 拖动放置区内的元素
$(this).find('button').draggable({
revert: true,
onStopDrag: function(e){
var _index = tab[$(this).html()];
$(this).parent().remove();
$('.items li:eq('+_index+')').draggable('enable');
$('.items li:eq('+_index+')').find('i').css('backgroundColor','red');
}
});
}
});
// 列指标放置区
$('.target-column').droppable({
onDragEnter: function(e,source){
$(this).css('border','1px solid red');
},
onDragLeave: function(e,source){
$(this).css('border','1px solid black');
},
onDrop: function(e,source){
// 判断拖动的元素是否存在于放置区内
if($(source).draggable('options').proxy === 'clone'){
// 禁用拖动
NotDrag(source);
var buttonName = $(source).find('span').html();
tab[buttonName] = $(source).index();
var Ele = $('');
Ele.appendTo('.target-column ul');
}
$(this).css('border','1px solid black');
// 拖动放置区内的元素
$(this).find('button').draggable({
revert: true,
onDrag: function(e){
$(e.data.parent).find('select').hide();
},
onStopDrag: function(e){
var _index = tab[$(this).html()];
$(this).parent().remove();
$('.items li:eq('+_index+')').draggable('enable');
$('.items li:eq('+_index+')').find('i').css('backgroundColor','red');
$(e.target).siblings('select').show();
}
});
}
});
//禁止拖动
function NotDrag(source){
$(source).draggable('disable');//禁用拖动动作
$(source).find('i').css('backgroundColor','grey');
}以上是“easyUI中draggable怎么用”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注创新互联网站建设公司行业资讯频道!
另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
网站名称:easyUI中draggable怎么用-创新互联
路径分享:http://www.scyingshan.cn/article/dgjhjp.html


咨询
建站咨询
