make textlist fire more events

This commit is contained in:
rlx 2011-01-15 23:26:20 +00:00
parent 64e383ea4b
commit 19d680c1d9
3 changed files with 48 additions and 18 deletions

View file

@ -370,8 +370,8 @@ Miscellaneous
*/
.OxThemeClassic .OxTooltip {
border: 1px solid rgba(128, 128, 128, 0.75);
background: rgba(255, 255, 255, 0.75);
border: 1px solid rgba(128, 128, 128, 0.96);
background: rgba(255, 255, 255, 0.96);
color: rgba(128, 128, 128, 1);
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

View file

@ -340,8 +340,8 @@ Miscellaneous
*/
.OxThemeModern .OxTooltip {
border: 1px solid rgba(128, 128, 128, 0.75);
background: rgba(0, 0, 0, 0.75);
border: 1px solid rgba(128, 128, 128, 0.96);
background: rgba(0, 0, 0, 0.96);
color: rgba(128, 128, 128, 1);
-moz-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);

View file

@ -1374,6 +1374,7 @@ requires
if (theme) {
$('img').each(function() {
var $this = $(this);
if (!$this.attr('src')) return; // fixme: remove, should't be neccessary
$this.attr({
src: $this.attr('src').replace(
'/ox.ui.' + theme + '/', '/ox.ui.' + arg + '/'
@ -7376,7 +7377,7 @@ requires
$.extend(self, {
columnPositions: [],
defaultColumnWidths: $.map(self.options.columns, function(v) {
return v.width;
return v.defaultWidth || v.width;
}),
itemHeight: 16,
page: 0,
@ -7387,6 +7388,12 @@ requires
return v.visible ? v : null;
})
});
// fixme: there might be a better way than passing both visible and position
self.options.columns.forEach(function(v) {
if (!Ox.isUndefined(v.position)) {
self.visibleColumns[v.position] = v;
}
})
$.extend(self, {
columnWidths: $.map(self.visibleColumns, function(v, i) {
return v.width;
@ -7488,7 +7495,7 @@ requires
function addColumn(id) {
//Ox.print('addColumn', id);
var column,
var column, ids,
index = 0;
$.each(self.options.columns, function(i, v) {
if (v.visible) {
@ -7531,6 +7538,7 @@ requires
}
});
}
triggerColumnChangeEvent();
}
function clickColumn(id) {
@ -7587,27 +7595,40 @@ requires
.appendTo(that.$head.$content.$element);
if (self.options.columnsResizable) {
$resize.addClass('OxResizable')
// fixme: make these their own named functions
.mousedown(function(e) {
var startWidth = self.columnWidths[i],
startX = e.clientX;
$window.mousemove(function(e) {
var x = e.clientX,
width = Ox.limit(
startWidth - startX + x,
self.options.columnWidth[0],
self.options.columnWidth[1]
);
resizeColumn(v.id, width);
var width = getWidth(e);
resizeColumn(v.id, width);
});
$window.one('mouseup', function() {
$window.one('mouseup', function(e) {
var width = getWidth(e);
resizeColumn(v.id, width);
that.triggerEvent('columnresize', {
id: v.id,
width: width
});
$window.unbind('mousemove');
});
function getWidth(e) {
return Ox.limit(
startWidth - startX + e.clientX,
self.options.columnWidth[0],
self.options.columnWidth[1]
);
}
})
// fixme: never use doubleclick, mousedown will fire too
// make working click dblclick and drag Ox.Element events
.dblclick(function() {
Ox.print('dblclick')
resizeColumn(
v.id, self.defaultColumnWidths[getColumnIndexById(v.id)]
);
var width = self.defaultColumnWidths[getColumnIndexById(v.id)];
resizeColumn(v.id, width);
that.triggerEvent('columnresize', {
id: v.id,
width: width
});
});
}
$left = $('<div>').addClass('OxLeft').appendTo($resize);
@ -7719,6 +7740,7 @@ requires
cursor: 'pointer'
});
that.$body.clearCache();
triggerColumnChangeEvent();
}
function getCell(id, key) {
@ -7865,6 +7887,14 @@ requires
}
}
function triggerColumnChangeEvent() {
that.triggerEvent('columnchange', {
ids: $.map(self.visibleColumns, function(v, i) {
return v.id;
})
});
}
function updateOrder(id) {
var pos = getColumnPositionById(id);
//Ox.print(id, pos)