- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何从另一个面板拖动面板项目?
例如:我想将 Name1 拖到 Name 6 面板。当我尝试按 shift+mousescrollkey 时,它会松开拖动项目。
提前致谢 :)
fiddle :https://fiddle.sencha.com/#fiddle/1hgf&view/editor
Ext.application({
name: 'Fiddle',
launch: function() {
Ext.define('myColumn', {
extend: 'Ext.view.View',
xtype: 'mycolumn',
padding: 5,
margin: 5,
style: 'background-color: #f2f2f2;',
itemSelector: 'div.nameselector',
tpl: ['<tpl for=".">', '<div class="nameselector<tpl if="isTemp"> temp</tpl>">', '{name}', '</div>', '</tpl>'],
listeners: {
render: function(me) {
var tempRec = null;
// Create drag zone
this.dragZone = new Ext.dd.DragZone(me.getEl(), {
// On receipt of a mousedown event, see if it is within a DataView node.
// Return a drag data object if so.
getDragData: function(e) {
// Use the DataView's own itemSelector (a mandatory property) to
// test if the mousedown is within one of the DataView's nodes.
var sourceEl = e.getTarget(me.itemSelector, 10);
// If the mousedown is within a DataView node, clone the node to produce
// a ddel element for use by the drag proxy. Also add application data
// to the returned data object.
if (sourceEl) {
d = sourceEl.cloneNode(true);
d.id = Ext.id();
return {
ddel: d,
sourceEl: sourceEl,
sourceZone: me,
sourceStore: me.store,
repairXY: Ext.fly(sourceEl).getXY(),
draggedRecord: me.getRecord(sourceEl)
}
}
},
getRepairXY: function() {
return this.dragData.repairXY;
}
});
this.dropZone = new Ext.dd.DropZone(me.getEl(), {
// Helper method to return correct class string if drop
// is permitted or not.
getAllowed: function(allowed) {
var proto = Ext.dd.DropZone.prototype;
return allowed ? proto.dropAllowed : proto.dropNotAllowed;
},
notifyOver: function(source) {
return this.getAllowed(source !== me.dragZone);
},
// Called when dragged element is over a drop zone.
// If allowed, make a copy of the dragged record to
// display in the zone (temporarily) by adding the record
// to the column store.
notifyEnter: function(source, e, data) {
var allowed = source !== me.dragZone;
if (allowed) {
tempRec = data.draggedRecord.clone();
// Set record field 'isTemp' to true which will cause the dataview
// template to use the 'temp' style defined in app.css
tempRec.set('isTemp', true);
me.getStore().add(tempRec);
}
return this.getAllowed(allowed);
},
// Called when the dragged element leaves a container. Remove
// the temporary record from the column store, removing the placeholder.
notifyOut: function(source, e, data) {
if (tempRec) {
me.getStore().remove(tempRec);
}
},
// When a dragged source is over a container,
// set the appropriate drop style for the dragged element.
onContainerOver: function(source, e, data) {
return this.getAllowed(source === me.dragZone);
},
// When the element is dropped on a column, check to see
// if we are dropping on the same column or not. If not,
// then remove record from source column, add record to
// drop column.
onContainerDrop: function(source, e, data) {
var overSame = source == me.dragZone,
dragData = source.dragData;
if (overSame) {
// Do not allow drop over same zone
// Return false to do a repair.
return false;
}
var rec = dragData.draggedRecord;
dragData.sourceStore.remove(rec);
me.getStore().add(rec);
// Clear temporary record
tempRec = null;
return true;
}
});
}
}
});
Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
plugins: 'viewport',
scrollable: 'horizontal',
layout: {
type: 'hbox',
align: 'stretch'
},
defaults: {
'width': 300
},
items: [{
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 1'
}]
}
}, {
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 2'
}]
}
}, {
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 3'
}]
}
}, {
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 4'
}]
}
}, {
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 5'
}]
}
}, {
xtype: 'mycolumn',
store: {
fields: ['name'],
data: [{
name: 'Name 6'
}]
}
}]
})
}
});
最佳答案
这是 ExtJS 版本中的一个错误 6.0.2
dragZone 上的滚动配置不起作用。 panel.scrollBy()
也不行您可以通过它滚动该面板。
我认为您将不得不更新您的框架。
当您更新到 6.2.0.589
时scrollBy 函数将开始工作。您可以向每一列添加鼠标事件,当您超过该事件时,滚动主面板。
containermouseover: function (me) {
var panel = Ext.first('#myMainPanel');
panel.scrollBy(me.getX() - panel.getWidth() / 4, 0, true);
},
6.2.0.981
时
scroll
dragZone 中的配置将开始工作。
this.dragZone = new Ext.dd.DragZone(me.getEl(), {
...
// this doesn't work in 6.0.2 but works in 6.2.0.981
scroll: true
});
关于extjs - 如何将 Name1 拖动到 Name 6 面板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41161350/
我有一堆字符串,其中包含以姓氏,名字格式命名的名称列表,并用逗号分隔,如下所示: names 序列化字符串中的“first name last name”,我们在Stack Overflow上找到一个
在尝试合并多个数据框时,我得到了一些非常奇怪的东西。帮助! 我需要通过“RID”和“VISCODE”列合并一堆数据框。这是它的外观示例: d1 = data.frame(ID = sample(9,
让我们尽可能简单地做第一个例子。 我想知道如何应用这个宏;像这里适用于例如printf("%s",macro(arg)); #include #include #include #define
以下2个bean声明之间有什么区别吗? @Bean(name = "bean1") public A getA() { return new A(); } @Bean @Quali
if(c.get_name(&name) && name && !strcmp(name, contName)) 谁能告诉我这行代码在 C++ 中的含义 最佳答案 如果 c 有一个名字并且它等于 co
我是 Rails 的初学者,在改进我的搜索查询时遇到了一些问题: 在我调用的 Controller 中: def index if params[:search] @persons = Pers
谁能帮我解决这段代码的最后一部分的编译错误它的说法创建构造函数请帮助 public class Officer { public static void main(String args[]
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 8 年前。 Improve t
我创建了一个 Web 应用程序,它具有使用 JSF 技术的 createBook.xhtml 并且它使用托管 Bean。在此页面中,用户必须在输入字段中填写所需信息,然后点击提交按钮。然后应使用 do
嘿,我正在尝试弄清楚如何将在 mySQL 中工作的语句转换为 PostgreSQL 并且很好奇是否有人知道解决方案。 这是在 mySQL 中有效的语句: def self.by_name(keywor
如果我要创建所有类型的类型,而不是使用字符串和原始类型,那么最大的缺点是什么? 通常它看起来像: String name = person.getName(); int age = person.ge
我正在尝试从以下内容中提取郊区名称: 12 street name, suburb name, CTG 1234 在 PHP 中使用正则表达式。 街道和郊区名称都可以是任意数量的单词长度。 CTG 是
我有一个呈现个人详细信息组件的父组件,并且正在注入(inject)父组件的验证器范围。如果我使用 v-validate 指令和 this.$validator.validateAll() 或 this
现在,据我了解,name[] 声明中的 extern 告诉编译器它的定义在其他地方(在我的程序中,我定义了它低于我使用它的部分)。但是为什么 strlen() 和 sizeof 会有不同的结果?str
我一直在解决一个问题: "Design a program that asks the user for a series of names (in no particular order). Aft
我的 XML 如下所示: 我想使用 JAXB 来阅读该内容。 我知道我能做到 @XmlRootElement(name="thing") public class Thing{
对于字符串 name[],我们可以使用 strlen(name)+1 和 sizeof(name) 互换 在我们的代码中没有经过深思熟虑?他们不一样吗?我检查了一下,发现两者的返回类型都是相同的,si
我正在尝试从以下内容中提取郊区名称: 12 street name, suburb name, CTG 1234 在 PHP 中使用正则表达式。 街道和郊区名称的长度可以是任意数量。 CTG 是 st
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 8 年前。 Improve t
bash 手册列出了 for 的语法。复合语句为for name [ [ in [ word ... ] ] ; ] do list ; done这意味着 do 之前的分号如果 in 是可选的子句省略
我是一名优秀的程序员,十分优秀!