diff --git a/js/aspnet.js b/js/aspnet.js index a2d120d2e810..8c31d6168cfd 100644 --- a/js/aspnet.js +++ b/js/aspnet.js @@ -27,6 +27,7 @@ } })(function($, setTemplateEngine, templateRendered, Guid, validationEngine, iteratorUtils, extractTemplateMarkup, encodeHtml) { var templateCompiler = createTemplateCompiler(); + var pendingCreateComponentRoutines = [ ]; function createTemplateCompiler() { var OPEN_TAG = "<%", @@ -123,19 +124,21 @@ } function createComponent(name, options, id, validatorOptions) { - var render = function(_, container) { - templateRendered.remove(render); - - var selector = "#" + id.replace(/[^\w-]/g, "\\$&"), - $component = $(selector, container)[name](options); + var selector = "#" + id.replace(/[^\w-]/g, "\\$&"); + pendingCreateComponentRoutines.push(function() { + var $component = $(selector)[name](options); if($.isPlainObject(validatorOptions)) { $component.dxValidator(validatorOptions); } - }; - - templateRendered.add(render); + }); } + templateRendered.add(function() { + var snapshot = pendingCreateComponentRoutines.slice(); + pendingCreateComponentRoutines = [ ]; + snapshot.forEach(function(func) { func(); }); + }); + return { createComponent: createComponent, diff --git a/testing/tests/DevExpress.aspnet/aspnet.tests.js b/testing/tests/DevExpress.aspnet/aspnet.tests.js index afcc9f2ac098..53a6934f6d58 100644 --- a/testing/tests/DevExpress.aspnet/aspnet.tests.js +++ b/testing/tests/DevExpress.aspnet/aspnet.tests.js @@ -415,7 +415,7 @@ $("#qunit-fixture").html( - '