trigger sort event in text list

This commit is contained in:
rlx 2011-08-18 07:55:39 +00:00
parent 19aa9b40e5
commit 3203556b46
2 changed files with 11 additions and 6 deletions

View file

@ -1319,7 +1319,7 @@ Ox.List = function(options, self) {
// may break other things // may break other things
!self.isAsync && triggerSelectEvent(value); !self.isAsync && triggerSelectEvent(value);
} else if (key == 'sort') { } else if (key == 'sort') {
Ox.print('---sort---') //Ox.print('---sort---')
updateSort(); updateSort();
} }
}; };

View file

@ -288,7 +288,11 @@ Ox.TextList = function(options, self) {
// so we use a timeout for now // so we use a timeout for now
setTimeout(function() { setTimeout(function() {
that.$body.options({sort: self.options.sort}); that.$body.options({sort: self.options.sort});
}, 10) }, 10);
that.triggerEvent('sort', {
key: self.options.sort[0].key,
operator: self.options.sort[0].operator
});
} }
function constructHead() { function constructHead() {
@ -694,11 +698,12 @@ Ox.TextList = function(options, self) {
function updateOrder(id) { function updateOrder(id) {
var pos = getColumnPositionById(id); var pos = getColumnPositionById(id);
//Ox.print(id, pos) if (pos > -1) {
that.$titles[pos].next().html(Ox.UI.symbols[ that.$titles[pos].next().html(Ox.UI.symbols[
'triangle_' + (self.options.sort[0].operator == '+' ? 'up' : 'down') 'triangle_' + (self.options.sort[0].operator == '+' ? 'up' : 'down')
]); ]);
} }
}
self.setOption = function(key, value) { self.setOption = function(key, value) {
//Ox.print('---------------------------- TextList setOption', key, value) //Ox.print('---------------------------- TextList setOption', key, value)