Skip to content

Instantly share code, notes, and snippets.

@Pzixel
Created May 26, 2016 11:03
Show Gist options
  • Save Pzixel/c58063534f21cb42ec5bea4f93b72120 to your computer and use it in GitHub Desktop.
Save Pzixel/c58063534f21cb42ec5bea4f93b72120 to your computer and use it in GitHub Desktop.
function runLoad(controls) {
var deferreds = [];
for (var i = 0; i < controls.length; i++) {
deferreds.push($.Deferred());
var container = $('#' + controls[i].ContainerId);
container.html('');
container.load(controls[i].ActionUrl + '?nodeName={0}&nodeType={1}'.f(nodeName, nodeType), function (j) {
return function() {
deferreds[j].resolve();
}
}(i));
}
$.when.apply(null, deferreds).then(function() {
formParsley = $('#configuration_form').parsley();
var configContainer = $('#config_container');
configContainer.children('div').each(function () {
var containerContent = this.getElementsByClassName('panel-collapse')[0].innerHTML;
if (containerContent == null || containerContent === '') {
$(this).hide();
} else {
$(this).show();
}
});
configContainer.show();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment