Hi,
I'm trying to implement a similar list-behaviour like the iOS App Clear. That is, if you swipe a list-item to the right it gets marked as "done" and if you swipe to the left you can delete it.
More info in this thread: http://www.sencha.com/forum/showthre...376#post937376
As you can read my approach looks like this
Code:
Ext.define('todon.view.Tasks', { extend: 'Ext.List',
xtype: 'TaskList',
requires: [
""
],
config: {
id: "listview",
store: "Tasks",
itemTpl: [
' <div class="list-item" style="background: {colorcode}green;">',
' <div class="list-item-inner">',
' <div class="task-name">{Name}</div>',
' <div class="task-category">{Categories}</div>',
' <div class="task-date">{date}</div>',
' <div class="task-timetracked">{TimeTracked}</div>',
' <p class="delete" style="position: absolute; right: 5px; top: 20px; display: none;">',
' <img src="resources/images/delete.png" alt="delete" />',
' </p>',
' </div>',
' <div class="button-bar">',
' <div class="left-handle"></div>',
' <div class="done"></div>',
' <div class="details"></div>',
' <div class="timer"></div>',
' <div class="delete"></div>',
' </div>',
' </div>'
].join(""),
listeners: {
itemtouchstart: function (list, index, target, record, e, eOpts) {
var config = {
direction: "horizontal",
constraint: {
min: {x: -300, y:0 },
max: {x: 300, y: 0}
},
listeners: {
drag: function (obj, e, xPos, yPos) {
//console.log(obj)
//console.log(xPos);
}
}
},
list = Ext.getCmp("listview");
if (!target.hasListener("drag")) {
list.setScrollable(false);
target.setDraggable(config);
} else {
console.log("target has listener already");
}
},
itemtouchend: function (series, item, event, eOpts) {
var list = Ext.getCmp("listview");
console.log("touchend on", item);
list.setScrollable(true);
}
}
}
});
The Problem:
Whenever I start to touch/drag a list item, it's container get's the following css assigned:
Code:
element.style {min-height: 47px !important;
-webkit-transform: translate3d(-134px, 0px, 0px);
}
Matched CSS Rules
.x-stretched.x-container {
display: -webkit-box;
-webkit-box-orient: vertical;
box-orient: vertical;
}
.x-list .x-list-item {
position: absolute !important; <- added
left: 0;
top: 0;
color: black;
width: 100%;
}
.x-size-monitored {
position: relative; <- removed
}
.x-paint-monitored {
position: relative; <- removed
}
.x-draggable {
z-index: 1;
}
Now, the translate3d is all good because I want that, but how can I make it so the elements stay relative. I mean now, each item gets pushed to the top and stays there .. meaning the whole list layout gets destroyed ..
Anyone knows how to change this quickly?