forked from 0x2620/oxjs
support for drag and drop
This commit is contained in:
parent
9ea5cce853
commit
5d454f0a80
8 changed files with 39 additions and 11 deletions
|
|
@ -77,7 +77,12 @@ Ox.IconList = function(options, self) {
|
|||
type: 'icon',
|
||||
unique: self.options.unique
|
||||
}, $.extend({}, self)) // pass event handler
|
||||
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation));
|
||||
.addClass('OxIconList Ox' + Ox.toTitleCase(self.options.orientation))
|
||||
.bindEvent({
|
||||
select: function() {
|
||||
self.options.selected = that.$element.options('selected');
|
||||
}
|
||||
});
|
||||
|
||||
updateKeys();
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ Ox.List = function(options, self) {
|
|||
0, 60, 60, 60, 60, 60, 60, 63, 64, 63, 60, 66, 60, 65, 70, 60, 64, 68, 72, 76, 60
|
||||
];
|
||||
}
|
||||
/*
|
||||
if (self.options.draggable) {
|
||||
that.bind({
|
||||
dragstart: function(e) {
|
||||
|
|
@ -172,6 +173,7 @@ Ox.List = function(options, self) {
|
|||
}
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
if (!self.isAsync) {
|
||||
self.listLength = self.options.items.length;
|
||||
|
|
@ -839,7 +841,13 @@ Ox.List = function(options, self) {
|
|||
} else if (self.selected.length > 1) {
|
||||
// this could be the first click
|
||||
// of a double click on multiple items
|
||||
// or the mousedown of a drag of multiple items
|
||||
selectTimeout = true;
|
||||
that.$content.one({
|
||||
mousemove: function() {
|
||||
self.clickTimeout && clearTimeout(self.clickTimeout);
|
||||
}
|
||||
});
|
||||
} else if (self.options.type == 'text' && hadFocus) {
|
||||
var $cell = findCell(e),
|
||||
$element = $cell || self.$items[pos];
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ Ox.TextList = function(options, self) {
|
|||
columnsResizable: false,
|
||||
columnsVisible: false,
|
||||
columnWidth: [40, 800],
|
||||
droppable: null,
|
||||
id: '',
|
||||
items: null, // function() {} {sort, range, keys, callback} or array
|
||||
max: -1,
|
||||
|
|
@ -380,7 +381,7 @@ Ox.TextList = function(options, self) {
|
|||
|
||||
function constructItem(data) {
|
||||
var $item = $('<div>')
|
||||
.addClass('OxTarget')
|
||||
.addClass('OxTarget' + (data.droppable ? ' OxDroppable' : ''))
|
||||
.css({
|
||||
width: getItemWidth(true) + 'px'
|
||||
});
|
||||
|
|
@ -516,7 +517,7 @@ Ox.TextList = function(options, self) {
|
|||
}
|
||||
|
||||
function getCell(id, key) {
|
||||
Ox.print('getCell', id, key)
|
||||
//Ox.print('getCell', id, key)
|
||||
var $item = getItem(id);
|
||||
key = key || '';
|
||||
return $($item.find('.OxCell.OxColumn' + Ox.toTitleCase(key))[0]);
|
||||
|
|
@ -847,7 +848,7 @@ Ox.TextList = function(options, self) {
|
|||
|
||||
that.value = function(id, key, value) {
|
||||
// fixme: make this accept id, {k: v, ...}
|
||||
Ox.print('value', id, key, value)
|
||||
//Ox.print('value', id, key, value)
|
||||
var $item = getItem(id),
|
||||
$cell = getCell(id, key),
|
||||
column = self.options.columns[getColumnIndexById(key)];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue