Guest User

Untitled

a guest
May 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function LoadCategoriesSuccess(data) {
  2.             CategorienGehad = new Array();
  3.             var CategorienGoed = new Array();
  4.             jQuery.removeFromArray = function (value, arr) {
  5.                 return jQuery.grep(arr, function (elem, index) {
  6.                     return elem !== value;
  7.                 });
  8.             };
  9.  
  10.  
  11.             var aantalCat = data.d.length;
  12.  
  13.  
  14.             while (aantalCat != CategorienGoed.length) {
  15.  
  16.                 $.each(data.d, function (index, value) {
  17.  
  18.                     if (value.Parent === null) {
  19.  
  20.                         $('#productList').append('<div data-role="collapsible" class = "Category" id="Category-' + value.Id + '" data-content-theme="d"><h3>' + value.Name + " - " + value.Type + '</h3><div id = "appendDiv-' + value.Id + '"  data-role="collapsible" data-theme="c" data-content-theme="c"></div><ul data-role="listview"  data-theme="d" data-inset = "true" id= "list-' + value.Id + '"</ul></div>');
  21.                         $('#productList').trigger('create');
  22.                                            
  23.                         CategorienGoed.push(value.Id);
  24.                         data.d = jQuery.removeFromArray(value, data.d);
  25.                     }
  26.  
  27.                     else {
  28.                                    
  29.  
  30.                         $.each(CategorienGoed, function (index2, value2) {
  31.                        
  32.                             if (value2 === value.Parent.Id) {
  33.                                 $('#appendDiv-' + value.Parent.Id).append('<div data-role="collapsible" class = "Category" data-content-theme="d" id="Category-' + value.Id + '"><h3>' + value.Name + " - " + value.Type + '</h3><div id = "appendDiv-' + value.Id + '" data-role="collapsible" data-theme="c" data-content-theme="c"></div><ul data-role="listview" data-theme="d" data-inset = "true" id = "list-' + value.Id + '" </ul></div>');
  34.                                 $('#appendDiv-' + value.Parent.Id).trigger('create');
  35.  
  36.  
  37.                                 CategorienGoed.push(value.Id);
  38.                                 data.d = jQuery.removeFromArray(value, data.d);
  39.                             }
  40.  
  41.                         });
  42.  
  43.                     }              
  44.                    
  45.                 });
  46.  
  47.                 //alert(CategorienGoed.length);
  48.  
  49.                 //console.log(CategorienGoed.length);
  50.             }
Add Comment
Please, Sign In to add comment