forked from 0x2620/oxjs
adding groups
This commit is contained in:
parent
705016e5a6
commit
5f4cc4e793
3 changed files with 129 additions and 7 deletions
|
|
@ -1,6 +1,7 @@
|
|||
$(function() {
|
||||
Ox.theme("modern");
|
||||
var $body = $("body"),
|
||||
$document = $(document),
|
||||
app = new Ox.App({
|
||||
requestURL: "http://blackbook.local:8000/api/"
|
||||
// requestURL: "http://lion.oil21.org:8000/api/"
|
||||
|
|
@ -33,6 +34,106 @@ $(function() {
|
|||
],
|
||||
size: "large"
|
||||
}),
|
||||
groups = [
|
||||
{
|
||||
id: "director",
|
||||
title: "Director"
|
||||
},
|
||||
{
|
||||
id: "country",
|
||||
title: "Country"
|
||||
},
|
||||
{
|
||||
id: "year",
|
||||
title: "Year"
|
||||
},
|
||||
/*
|
||||
{
|
||||
id: "language",
|
||||
title: "Language"
|
||||
},
|
||||
{
|
||||
id: "genre",
|
||||
title: "Genre"
|
||||
}
|
||||
*/
|
||||
],
|
||||
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);
|
||||
},
|
||||
sort: [
|
||||
{
|
||||
key: "name",
|
||||
operator: "+"
|
||||
}
|
||||
]
|
||||
}),
|
||||
size: size
|
||||
});
|
||||
});
|
||||
Ox.print("elements", elements)
|
||||
var $groups = new Ox.SplitPanel({
|
||||
elements: elements,
|
||||
orientation: "horizontal"
|
||||
}),
|
||||
$listbar = Ox.Bar({
|
||||
size: 24
|
||||
});
|
||||
$select = Ox.Select({
|
||||
id: "selectView",
|
||||
items: [
|
||||
{
|
||||
checked: true,
|
||||
id: "list",
|
||||
title: "View: List"
|
||||
},
|
||||
{
|
||||
id: "icons",
|
||||
title: "View: Icons"
|
||||
}
|
||||
]
|
||||
}).css({
|
||||
margin: "4px"
|
||||
}).width(128).appendTo($listbar);
|
||||
$list = new Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
|
|
@ -138,10 +239,14 @@ $(function() {
|
|||
}
|
||||
]
|
||||
}),
|
||||
$main = Ox.SplitPanel({
|
||||
$right = Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: $menu,
|
||||
element: $groups,
|
||||
size: 128
|
||||
},
|
||||
{
|
||||
element: $listbar,
|
||||
size: 24
|
||||
},
|
||||
{
|
||||
|
|
@ -149,5 +254,17 @@ $(function() {
|
|||
}
|
||||
],
|
||||
orientation: "vertical"
|
||||
})
|
||||
$main = Ox.SplitPanel({
|
||||
elements: [
|
||||
{
|
||||
element: $menu,
|
||||
size: 24
|
||||
},
|
||||
{
|
||||
element: $right
|
||||
}
|
||||
],
|
||||
orientation: "vertical"
|
||||
}).appendTo($body);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue