[英]EXT JS auto scroll container when drag grid column
I have EXT JS grid with width greater then screen width. 我的EXT JS网格的宽度大于屏幕宽度。 I have to drag columns to change its order, but when I drag column header to edge of screen - container not scroll.
我必须拖动列以更改其顺序,但是当我将列标题拖动到屏幕边缘时-容器无法滚动。 So a need to scroll in manually first and then drad column to right place.
因此,需要先手动滚动,然后再将drad列滚动到正确的位置。 How can I make container autoscroll left or right when I drag column?
拖动列时如何使容器向左或向右自动滚动? I try containerScroll with gridviewdragdrop plugin but it works only when i drag rows:
我尝试使用带有gridviewdragdrop插件的containerScroll ,但是它仅在拖动行时有效:
viewConfig: {
plugins: {
ptype: 'gridviewdragdrop',
containerScroll: true
},
}
Ok, after spending some time I found workround. 好的,花了一些时间后,我找到了解决方法。 You have to add mousemove event to grid dom after render and control left and right zones and then use scrollBy function of grid view.
渲染并控制左右区域后,必须将mousemove事件添加到网格dom,然后使用网格视图的scrollBy函数。 Here is code:
这是代码:
listeners: {
afterrender:function(me){
//console.log(me);
me.el.dom.onmousemove=function(ev){
if (ev.x>(me.el.dom.clientWidth-50)){
// console.log(ev);
me.view.scrollBy(50, 0, false);
}
if (ev.x<50){
// console.log(ev);
me.view.scrollBy(-50, 0, false);
}
};
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.