title: "Repository type (default is Maven 2)"
}
],
- pageSize: 5
+ pageSize: 5,
+ gridUpdateCallBack: function(){
+ $.log("gridUpdateCallBack");
+ $("#main-content #managed-repositories-table [title]").twipsy();
+ }
});
ko.applyBindings(managedRepositoriesViewModel,$("#main-content #managed-repositories-table").get(0));
$("#main-content #managed-repositories-pills").pills();
$("#managed-repositories-view").addClass("active");
removeMediumSpinnerImg("#main-content #managed-repositories-content");
- $("#main-content #managed-repositories-table [title]").twipsy();
activateManagedRepositoriesGridTab();
}
}
<div id="managed-repositories-tabs-content" class="pill-content">
<div id="managed-repositories-view" class="active">
<table class="bordered-table zebra-striped" id="managed-repositories-table"
- data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko_managed-repositoriesGrid',pageLinksId:'managed-repositoriesPagination'">
+ data-bind="simpleGrid: gridViewModel,simpleGridTemplate:'ko_managed-repositoriesGrid',pageLinksId:'managed-repositoriesPagination',data:'managedRepositories'">
</table>
<div id="managed-repositoriesPagination"></div>
</div>
<div id="managed-repository-edit" data-bind='template: {name:"managed-repository-edit-tmpl"}'>
-
</div>
</div>
</div>
}\r
\r
function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {\r
+\r
options = options || {};\r
var templateEngineToUse = (options['templateEngine'] || _templateEngine);\r
ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse);\r
\r
// Support selecting template as a function of the data being rendered\r
var templateName = typeof(template) == 'function' ? template(bindingContext['$data']) : template; \r
-\r
var renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);\r
if (renderMode == "replaceNode") {\r
targetNodeOrNodeArray = renderedNodesArray;\r
ko.simpleGrid = {
// Defines a view model class you can use to populate a grid
viewModel: function (configuration) {
- this.data = configuration.data;
+ this.data = ko.observableArray(configuration.data);
this.currentPageIndex = ko.observable(0);
this.pageSize = configuration.pageSize || 5;
this.columns = configuration.columns;
this.i18n=function(key){
return $.i18n.prop(key);
};
+ this.gridUpdateCallBack = configuration.gridUpdateCallBack;
+ this.pageLinksUpdateCallBack = configuration.pageLinksUpdateCallBack;
}
};
// Render the main grid
var gridContainer = element.appendChild(document.createElement("DIV"));
- ko.renderTemplate(gridTemplateName, viewModel, { templateEngine: templateEngine }, gridContainer, "replaceNode");
+ ko.renderTemplate(gridTemplateName, viewModel, { templateEngine: templateEngine }, gridContainer, "replaceNode")
+ .subscribe(viewModel.gridUpdateCallBack?viewModel.gridUpdateCallBack:function(){});
// Render the page links
var pageLinksContainer = $("#"+allBindings.pageLinksId).get(0);
- ko.renderTemplate(pageLinksTemplateName, viewModel, { templateEngine: templateEngine }, pageLinksContainer, "replaceNode");
+ ko.renderTemplate(pageLinksTemplateName, viewModel, { templateEngine: templateEngine }, pageLinksContainer, "replaceNode")
+ .subscribe(viewModel.pageLinksUpdateCallBack?viewModel.pageLinksUpdateCallBack:function(){});
}
};
})();
\ No newline at end of file