1
0
Fork 0
forked from 0x2620/oxjs

some support for async listmaps

This commit is contained in:
rolux 2011-05-29 12:42:38 +02:00
commit 14174136d8
3 changed files with 136 additions and 44 deletions

View file

@ -23,8 +23,10 @@ Ox.ListMap = function(options, self) {
addPlace: null,
height: 256,
labels: false,
pageLength: 100,
places: null,
selected: [],
sort: [{key: 'geoname', operator: '+'}],
width: 256
})
.addClass('OxListMap')
@ -34,6 +36,8 @@ Ox.ListMap = function(options, self) {
height: self.options.height + 'px'
});
self.isAsync = Ox.isFunction(self.options.places);
self.columns = [
{
addable: false, // fixme: implement
@ -243,11 +247,9 @@ Ox.ListMap = function(options, self) {
columnsVisible: true,
//items: Ox.clone(self.options.places),
items: self.options.places,
pageLength: 100,
pageLength: self.options.pageLength,
scrollbarVisible: true,
sort: [
{key: 'name', operator: '+'}
]
sort: self.options.sort
})
.bindEvent({
'delete': removeItem,
@ -455,7 +457,7 @@ Ox.ListMap = function(options, self) {
];
*/
if (Ox.isArray(self.options.places)) {
if (!self.isAsync) {
init(self.options.places)
} else {
self.options.places({}, function(result) {
@ -464,7 +466,8 @@ Ox.ListMap = function(options, self) {
keys: self.columns.map(function(column) {
return column.id
}),
range: [0, result.data.items]
range: [0, result.data.items],
sort: self.options.sort,
}, function(result) {
Ox.print('DATA', result)
init(result.data.items);