mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 14:17:57 +01:00
fetchLabels with postUpdate callback
This commit is contained in:
parent
2ec941e1a0
commit
f048d0adb7
@ -163,5 +163,12 @@ $(function () {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$(document).ready(fetchLabels())
|
$(document).ready(fetchLabels({
|
||||||
|
postUpdate: function(data) {
|
||||||
|
var labels = data.labels;
|
||||||
|
for (var i = 0; i < labels.length; i++) {
|
||||||
|
createLabelItem(labels[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
});
|
});
|
||||||
|
@ -13,15 +13,14 @@ function createLabelItem(data) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchLabels() {
|
function fetchLabels(options) {
|
||||||
jQuery.ajax("c/restful/labels/", {
|
jQuery.ajax("c/restful/labels/", {
|
||||||
async:false,
|
async:false,
|
||||||
dataType:'json',
|
dataType:'json',
|
||||||
type:'GET',
|
type:'GET',
|
||||||
success:function (data) {
|
success:function (data) {
|
||||||
var labels = data.labels;
|
if (options.postUpdate) {
|
||||||
for (var i = 0; i < labels.length; i++) {
|
options.postUpdate(data)
|
||||||
createLabelItem(labels[i])
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error:function (jqXHR, textStatus, errorThrown) {
|
error:function (jqXHR, textStatus, errorThrown) {
|
||||||
|
Loading…
Reference in New Issue
Block a user