forked from 0x2620/oxjs
making groups work
This commit is contained in:
parent
5f4cc4e793
commit
f4972f45c9
2 changed files with 224 additions and 133 deletions
|
|
@ -58,55 +58,57 @@ $(function() {
|
|||
}
|
||||
*/
|
||||
],
|
||||
$group = [],
|
||||
elements = [],
|
||||
documentWidth = $document.width();
|
||||
Ox.print("documentWidth", documentWidth)
|
||||
$.each(groups, function(i, v) {
|
||||
var size = documentWidth / 3 + (documentWidth % 3 > i);
|
||||
elements.push({
|
||||
element: new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
align: "left",
|
||||
id: "name",
|
||||
operator: "+",
|
||||
title: "Name",
|
||||
visible: true,
|
||||
width: size - 72
|
||||
},
|
||||
{
|
||||
align: "right",
|
||||
id: "items",
|
||||
operator: "-",
|
||||
title: "Items",
|
||||
visible: true,
|
||||
width: 60
|
||||
}
|
||||
],
|
||||
id: "group_" + v.id,
|
||||
request: function(options) {
|
||||
delete options.keys;
|
||||
app.request("find", $.extend(options, {
|
||||
group: v.id,
|
||||
query: {
|
||||
conditions: [
|
||||
{
|
||||
key: "country",
|
||||
value: "",
|
||||
operator: ""
|
||||
}
|
||||
],
|
||||
operator: ""
|
||||
}
|
||||
}), options.callback);
|
||||
$group[i] = new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
align: "left",
|
||||
id: "name",
|
||||
operator: v.id == "year" ? "-" : "+",
|
||||
title: v.title,
|
||||
unique: true,
|
||||
visible: true,
|
||||
width: size - 50 - ($.browser.mozilla ? 16 : 12)
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
key: "name",
|
||||
operator: "+"
|
||||
{
|
||||
align: "right",
|
||||
id: "items",
|
||||
operator: "-",
|
||||
title: "Items",
|
||||
visible: true,
|
||||
width: 50
|
||||
}
|
||||
],
|
||||
id: "group_" + v.id,
|
||||
request: function(options) {
|
||||
delete options.keys;
|
||||
app.request("find", $.extend(options, {
|
||||
group: v.id,
|
||||
query: {
|
||||
conditions: [
|
||||
{
|
||||
key: "country",
|
||||
value: "",
|
||||
operator: ""
|
||||
}
|
||||
],
|
||||
operator: ""
|
||||
}
|
||||
]
|
||||
}),
|
||||
}), options.callback);
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
key: "name",
|
||||
operator: "+"
|
||||
}
|
||||
]
|
||||
});
|
||||
elements.push({
|
||||
element: $group[i],
|
||||
size: size
|
||||
});
|
||||
});
|
||||
|
|
@ -141,6 +143,7 @@ $(function() {
|
|||
id: "id",
|
||||
operator: "+",
|
||||
title: "ID",
|
||||
unique: true,
|
||||
visible: true,
|
||||
width: 80
|
||||
},
|
||||
|
|
@ -205,7 +208,6 @@ $(function() {
|
|||
id: "rating",
|
||||
operator: "-",
|
||||
title: "Rating",
|
||||
visible: false,
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
|
|
@ -213,7 +215,6 @@ $(function() {
|
|||
id: "votes",
|
||||
operator: "-",
|
||||
title: "Votes",
|
||||
visible: false,
|
||||
width: 80
|
||||
}
|
||||
],
|
||||
|
|
@ -267,4 +268,47 @@ $(function() {
|
|||
],
|
||||
orientation: "vertical"
|
||||
}).appendTo($body);
|
||||
$.each(groups, function(i, group) {
|
||||
Ox.Event.bind(null, "select_group_" + group.id, function(event, data) {
|
||||
Ox.print("OK")
|
||||
$list.options({
|
||||
request: function(options) {
|
||||
app.request("find", $.extend(options, {
|
||||
query: {
|
||||
conditions: $.map(data.ids, function(v, j) {
|
||||
return {
|
||||
key: group.id,
|
||||
value: v,
|
||||
operator: "="
|
||||
}
|
||||
}),
|
||||
operator: "|"
|
||||
}
|
||||
}), options.callback);
|
||||
}
|
||||
});
|
||||
$.each(groups, function(i_, group_) {
|
||||
if (i_ != i) {
|
||||
$group[i_].options({
|
||||
request: function(options) {
|
||||
delete options.keys;
|
||||
app.request("find", $.extend(options, {
|
||||
group: group_.id,
|
||||
query: {
|
||||
conditions: $.map(data.ids, function(v, j) {
|
||||
return {
|
||||
key: group.id,
|
||||
value: v,
|
||||
operator: "="
|
||||
}
|
||||
}),
|
||||
operator: "|"
|
||||
}
|
||||
}), options.callback);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue