public/js/knockout/sharedFolder/loadData.js
/**
	* Initializes view model and apply bindings
	*/
Initializes view model and apply bindings
Initializes view model and apply bindings
function initializeDemoData() {
		var container = document.getElementById('bind-container');
		var listViewModel = new ListViewModel();
		$.getJSON("/json/getSharedFolders", function(result){
				for (var j = 0; j < result.length; j++) {
					var folder = result[j],
							folderViewModel = new ItemViewModel(listViewModel, true, folder.id, folder.title, folder.description, folder.parentId);
					listViewModel.allItems.push(folderViewModel);
				}
			listViewModel.initialize();
		});
		ko.applyBindings(listViewModel, container);
	}
function initializeDemoData ( ) { var container = document . getElementById ( 'bind-container' ) ; var listViewModel = new ListViewModel ( ) ; $ . getJSON ( "/json/getSharedFolders" , function ( result ) { for ( var j = 0 ; j < result . length ; j ++ ) { var folder = result [ j ] , folderViewModel = new ItemViewModel ( listViewModel , true , folder . id , folder . title , folder . description , folder . parentId ) ; listViewModel . allItems . push ( folderViewModel ) ; } listViewModel . initialize ( ) ; } ) ; ko . applyBindings ( listViewModel , container ) ; }
Initializes view model and apply bindings
Initializes view model and apply bindings
// Get container for binding view model // Create list view model // Add folders to list // Initialize list view model // Bind view model to view