filter rewrite, support most special types

This commit is contained in:
rlx 2011-06-02 05:29:58 +00:00
parent 65aadc19e9
commit 67dd877874

View file

@ -439,27 +439,60 @@ Ox.Filter = function(options, self) {
}
function renderInput(condition, index) {
return Ox.Input(!Ox.isArray(condition.value) ? {
value: condition.value,
width: 288
} : {
value: condition.value[index],
width: 128
});
/*
Ox.DateInput({
id: 'end',
width: {
day: 32,
month: 32,
year: 48
var $input,
findKey = Ox.getObjectById(self.options.findKeys, condition.key),
isArray = Ox.isArray(condition.value),
type = findKey.type == 'integer' ? 'int' : findKey.type,
formatArgs, formatType, title;
if (findKey.format) {
formatArgs = findKey.format.args
formatType = findKey.format.type;
if (findKey.format.type == 'date') {
$input = Ox.DateInput(!isArray ? {
//value: condition.value,
width: {day: 66, month: 66, year: 140}
} : {
//value: condition.value[index],
width: {day: 32, month: 32, year: 48}
});
} else if ([
'currency', 'percent', 'unit', 'value'
].indexOf(formatType) > -1) {
title = formatType == 'percent' ? '%' : formatArgs[0];
$input = Ox.FormElementGroup({
elements: [
Ox.Input({
type: type,
value: !isArray ? condition.value : condition.value[index],
width: !isArray ? 240 : 80
}),
formatType == 'value' ? Ox.Select({
overlap: 'left',
items: ['K', 'M', 'G', 'T'].map(function(prefix) {
return {id: prefix + title, title: prefix + title};
}),
width: 48
}) : Ox.Label({
overlap: 'left',
textAlign: 'center',
title: title,
width: 48
})
],
float: 'right',
width: !isArray ? 288 : 128
})
}
})
*/
} else {
$input = Ox.Input({
type: type,
value: !isArray ? condition.value : condition.value[index],
width: !isArray ? 288 : 128
});
}
return $input;
}
function renderConditions() {
Ox.print('renderConditions', self.options.query)
var $conditions = [];
@ -524,15 +557,6 @@ Ox.Filter = function(options, self) {
return $condition;
}
function updateConditions() {
self.$conditions.forEach(function(condition, pos) {
condition.data({position: pos, subposition: -1});
});
self.$conditions[0].options('elements')[3].options({
disabled: self.options.query.conditions.length == 1
});
}
return that;
};