1
0
Fork 0
forked from 0x2620/oxjs

support drag and drop in text lists

This commit is contained in:
rlx 2011-09-04 12:19:36 +00:00
commit 63885b8c1b
3 changed files with 33 additions and 19 deletions

View file

@ -29,6 +29,11 @@ Ox.List <f:Ox.Element> List Element
self <o> shared private variable
add <!> item added
delete <!> item removed
draganddrop <!> Fires during drag
draganddropend <!> Fires on drop
draganddropenter <!> Fires when entering an item during drag
draganddropleave <!> Fires when leaving an item during drag
draganddropstart <i> Fires when drag starts
copy <!> copy
paste <!> paste
movie <!> move item
@ -326,7 +331,9 @@ Ox.List = function(options, self) {
}
function dragstart(event, e) {
if ($(e.target).is('.OxTarget')) {
var $target = $(e.target),
$parent = $target.parent();
if ($target.is('.OxTarget') || $parent.is('.OxTarget')) {
self.drag = {
ids: self.options.selected
}

View file

@ -7,7 +7,7 @@ Ox.TextList <f:Ox.Element> TextList Object
(options, self) -> <f> TextList Object
options <o> Options object
columns <[o]|[]>
Fixme: There's probably more...
# Fixme: There's probably more...
addable <b>
editable <b>
format <f>
@ -19,24 +19,26 @@ Ox.TextList <f:Ox.Element> TextList Object
unique <b> If true, this column acts as unique id
visible <b>
width <n>
columnsMovable <b|false>
columnsRemovable <b|false>
columnsResizable <b|false>
columnsVisible <b|false>
columnWidth <a|[40, 800]>
columnsMovable <b|false> If true, columns can be re-ordered
columnsRemovable <b|false> If true, columns are removable
columnsResizable <b|false> If true, columns are resizable
columnsVisible <b|false> If true, columns are visible
columnWidth <[n]|[40, 800]> Minimum and maximum column width
draggable <b|false> If true, items can be dragged
id <s|''>
items <f|null> function() {} {sort, range, keys, callback} or array
max <n|-1> Maximum number of items that can be selected (-1 for all)
min <n|0> Minimum number of items that must be selected
pageLength <n|100>
scrollbarVisible <b|false>
pageLength <n|100> Number of items per page
scrollbarVisible <b|false> If true, the scrollbar is always visible
selected <a|[]>
sort <a|[]>
sortable <b|false> If true, elements can be re-ordered
self <o> shared private variable
@*/
// fixme: options.columnsMovable, but options.sortable ... pick one.
Ox.TextList = function(options, self) {
// fixme: rename to TableList
@ -206,12 +208,12 @@ Ox.TextList = function(options, self) {
}
})
.bindEvent({
edit: function(data) {
that.editCell(data.id, data.key);
},
cancel: function(data) {
Ox.print('cancel edit', data);
},
edit: function(data) {
that.editCell(data.id, data.key);
},
init: function(data) {
// fixme: why does this never reach?
//Ox.print('INIT????')
@ -223,6 +225,7 @@ Ox.TextList = function(options, self) {
}
})
.appendTo(that);
that.$body.$content.css({
width: getItemWidth() + 'px'
});