more list

This commit is contained in:
Rolux 2010-06-30 23:41:27 +02:00
parent f4972f45c9
commit a5c5ab7e4d
2 changed files with 25 additions and 13 deletions

View file

@ -532,6 +532,8 @@ requires
Ox.Request = function() { Ox.Request = function() {
// chained requests, make cancelable: id = 4.7.9
var cache = {}, var cache = {},
pending = {}, pending = {},
requests = {}, requests = {},
@ -2477,7 +2479,7 @@ requires
if (!Ox.isUndefined(self.$items[pos])) { if (!Ox.isUndefined(self.$items[pos])) {
self.$items[pos].addClass("OxSelected"); self.$items[pos].addClass("OxSelected");
} }
Ox.Event.trigger("select_" + self.options.id, { that.triggerEvent("select", {
ids: $.map(self.selected, function(v, i) { ids: $.map(self.selected, function(v, i) {
return self.ids[v]; return self.ids[v];
}) })
@ -2487,6 +2489,7 @@ requires
function clear() { function clear() {
$.each(self.requests, function(i, v) { $.each(self.requests, function(i, v) {
Ox.print("Ox.Request.cancel", v);
Ox.Request.cancel(v); Ox.Request.cancel(v);
}); });
$.extend(self, { $.extend(self, {
@ -2524,7 +2527,7 @@ requires
if (!Ox.isUndefined(self.$items[pos])) { if (!Ox.isUndefined(self.$items[pos])) {
self.$items[pos].removeClass("OxSelected"); self.$items[pos].removeClass("OxSelected");
} }
Ox.Event.trigger("select_" + self.options.id, { that.triggerEvent("select", {
ids: $.map(self.selected, function(v, i) { ids: $.map(self.selected, function(v, i) {
return self.ids[v]; return self.ids[v];
}) })
@ -2548,9 +2551,9 @@ requires
} }
function getPage() { function getPage() {
return self.options.orientation == "vertical" return self.options.orientation == "horizontal"
? Math.floor(that.scrollTop() / self.pageHeight) ? Math.floor(that.scrollLeft() / self.pageWidth)
: Math.floor(that.scrollLeft() / self.pageWidth); : Math.floor(that.scrollTop() / self.pageHeight);
} }
function getPositions() { function getPositions() {
@ -2855,7 +2858,7 @@ requires
key: key, key: key,
operator: operator operator: operator
} }
// fixme: trigger sort event here that.triggerEvent("sort", self.options.sort[0]);
updateSort(); updateSort();
} }
} }

View file

@ -3,8 +3,8 @@ $(function() {
var $body = $("body"), var $body = $("body"),
$document = $(document), $document = $(document),
app = new Ox.App({ app = new Ox.App({
requestURL: "http://blackbook.local:8000/api/" // requestURL: "http://blackbook.local:8000/api/"
// requestURL: "http://lion.oil21.org:8000/api/" requestURL: "http://lion.oil21.org:8000/api/"
}), }),
$menu = new Ox.MainMenu({ $menu = new Ox.MainMenu({
menus: [ menus: [
@ -24,6 +24,9 @@ $(function() {
{ checked: false, group: "sort_movies", id: "director", title: "Director" }, { checked: false, group: "sort_movies", id: "director", title: "Director" },
{ checked: false, group: "sort_movies", id: "country", title: "Country" }, { checked: false, group: "sort_movies", id: "country", title: "Country" },
{ checked: true, group: "sort_movies", id: "year", title: "Year" }, { checked: true, group: "sort_movies", id: "year", title: "Year" },
{ checked: false, group: "sort_movies", id: "runtime", title: "Runtime" },
{ checked: false, group: "sort_movies", id: "language", title: "Language" },
{ checked: false, group: "sort_movies", id: "genre", title: "Genre" },
] }, ] },
{ id: "order_movies", title: "Order Movies", items: [ { id: "order_movies", title: "Order Movies", items: [
{ checked: false, group: "order_movies", id: "ascending", title: "Ascending"}, { checked: false, group: "order_movies", id: "ascending", title: "Ascending"},
@ -72,7 +75,7 @@ $(function() {
title: v.title, title: v.title,
unique: true, unique: true,
visible: true, visible: true,
width: size - 50 - ($.browser.mozilla ? 16 : 12) width: size - 60 - ($.browser.mozilla ? 16 : 12)
}, },
{ {
align: "right", align: "right",
@ -80,7 +83,7 @@ $(function() {
operator: "-", operator: "-",
title: "Items", title: "Items",
visible: true, visible: true,
width: 50 width: 60
} }
], ],
id: "group_" + v.id, id: "group_" + v.id,
@ -109,6 +112,7 @@ $(function() {
}); });
elements.push({ elements.push({
element: $group[i], element: $group[i],
resizable: true,
size: size size: size
}); });
}); });
@ -270,10 +274,9 @@ $(function() {
}).appendTo($body); }).appendTo($body);
$.each(groups, function(i, group) { $.each(groups, function(i, group) {
Ox.Event.bind(null, "select_group_" + group.id, function(event, data) { Ox.Event.bind(null, "select_group_" + group.id, function(event, data) {
Ox.print("OK")
$list.options({ $list.options({
request: function(options) { request: function(options) {
app.request("find", $.extend(options, { return app.request("find", $.extend(options, {
query: { query: {
conditions: $.map(data.ids, function(v, j) { conditions: $.map(data.ids, function(v, j) {
return { return {
@ -292,7 +295,7 @@ $(function() {
$group[i_].options({ $group[i_].options({
request: function(options) { request: function(options) {
delete options.keys; delete options.keys;
app.request("find", $.extend(options, { return app.request("find", $.extend(options, {
group: group_.id, group: group_.id,
query: { query: {
conditions: $.map(data.ids, function(v, j) { conditions: $.map(data.ids, function(v, j) {
@ -311,4 +314,10 @@ $(function() {
}); });
}); });
}); });
Ox.Event.bind(null, "change_sort_movies", function(event, data) {
});
Ox.Event.bind(null, "sort_list", function(event, data) {
});
}); });