Created
October 1, 2010 14:00
-
-
Save pedrofaria/606252 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function map_refresh(map) { | |
if (map_plugin.alread_done) return true; | |
awPlus.API('map', 'GET', null, function(data) { | |
data.data.sids = []; | |
for (var sid in data.data.sys) { | |
data.data.sys[sid].id = parseInt(data.data.sys[sid].id); | |
data.data.sids.push(data.data.sys[sid]); | |
} | |
var store = new Ext.data.Store({ | |
model: 'Map', | |
sorters: 'id', | |
getGroupString: function(record) { | |
return record.get('name')[0]; | |
}, | |
data: data.data.sids, | |
}); | |
map.setStore(store); | |
map_plugin.alread_done = true; | |
}); | |
} | |
var map_plugin = { | |
name: 'map', | |
weight: 1, | |
alread_done: false, | |
onReady: function() { | |
Ext.regModel('Map', {fields: ['name', 'x', 'y', 'id', 'level']}); | |
var map = new Ext.List({ | |
tpl: ['<tpl for="."><div class="awsystem">{id} - {name} ({x}/{y})</div></tpl>'], | |
emptyText: '<p style="padding: 10px">Loading maps...</p>', | |
itemSelector: 'div.awsystem', | |
layout: 'card', | |
title: 'map', | |
iconCls: 'favorites', | |
tbTitle: 'Map', | |
singleSelect: true, | |
grouped: false, | |
indexBar: false, | |
store: new Ext.data.Store({ | |
model: 'Map', | |
sorters: 'name', | |
data: [], | |
}), | |
}); | |
map.on('activate', map_refresh); | |
awPlus.addTabPanelItem(map); | |
} | |
} | |
awPlus.registerPlugin(map_plugin); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment