1/******************************************************************************************************************************************/ 2/***************************************************************** custom.js **************************************************************/ 3/******************************************************************************************************************************************/ 4 var CustomJs = new function(){ 5 6 7 8 9 /* 10 Init 11 */ 12 this.Init = function(){ 13 14 curThis = this; 15 16 // Tabelle initialisieren 17 this.tabulatorElement.Init(); 18 19 }; 20 21 /** 22 * Produktbereich einblenden 23 * @param id 24 * @constructor 25 */ 26 this.ShowProductData = function(id){ 27 28 $('#productDataSectionOpener-'+id).hide(); 29 $('#productDataSection-'+id).slideDown(); 30 this.tabulatorElement.Init(); 31 32 }; 33 34 35 /** 36 * Fancybox für Bilder 37 * @param iIndex 38 * @param oItem 39 * @constructor 40 */ 41 this.InitFancybox = function( iIndex, oItem ){ 42 43 // Item 44 oItem = $(oItem); 45 46 // Add 47 oItem.addClass('Initialised'); 48 49 // Fancybox 50 var oFancyBox = oItem.fancybox({ 51 toolbar: true, 52 infobar: false, 53 smallBtn: false, 54 buttons: [ 55 'close' 56 ], 57 afterLoad: function( oInstance, oSlide){ 58 59 } 60 }); 61 62 }; 63 64 65 /** 66 * Tabelle 67 */ 68 69 this.tabulatorElement = new function() { 70 71 var productData = '.productData'; 72 var productTableDiv = '.productTableDiv'; 73 var productFilterDiv = '.productFilterDiv'; 74 var tabulator = new Array(); 75 76 77 78 this.Init = function() { 79 80 81 $(productData).each(function() { 82 var curItem = $(this); 83 84 tabulator[curItem.attr('id')] = initTabulator(curItem.find(productTableDiv)); 85 filter = initFilter(curItem.find(productFilterDiv), curItem.attr('id')); 86 87 $(window).resize(function(){ 88 tabulator[curItem.attr('id')].redraw(); 89 }); 90 }); 91 } 92 93 /** 94 * Filter initialisieren 95 * @param oItem 96 * @param id 97 */ 98 var initFilter = function(oItem, id) { 99 100 if(typeof(dropdowndata) != 'undefined') { 101 102 $(oItem).find('.imageDropDowns').each(function() { 103 var name = $(this).attr('name'); 104 105 if(typeof(name) != 'undefined') { 106 var jsonData = dropdowndata[name]; 107 var options = JSON.parse(jsonData); 108 var source = { 109 localdata: jsonData, 110 datatype: "json", 111 }; 112 var dataAdapter = new $.jqx.dataAdapter(source); 113 var item = $(this).jqxDropDownList({ 114 placeHolder: placeholder[name], 115 source: dataAdapter, 116 displayMember: "label", 117 valueMember: "value", 118 //itemHeight: 60, 119 height: 37, // Höhe des Dropdowns 120 width: 280, // Breite des Dropdowns 121 dropDownWidth: 370, 122 autoDropDownHeight:true, 123 renderer: function (index, label, value) { 124 var datarecord = options[index]; 125 //console.log(datarecord); 126 var imgurl = datarecord.image; 127 var img = ''; 128 if(typeof(imgurl) != 'undefined') { 129 img = '<img src="' + imgurl + '" alt="" />'; 130 } 131 var table = '<table class="dropdownoption"><tr><td class="dropdownoption1">' + img + '</td><td class="dropdownoption2">' + value + '</td><td class="dropdownoption3">' + label + '</td></tr></table>'; 132 return table; 133 } 134 }); 135 } 136 }); 137 } 138 139 var filterId = $(oItem).attr('id'); 140 141 var submitType = 'change'; 142 if(oItem.find('form input[type="Submit"]').length > 0 ) { 143 var submitType = 'submit'; 144 } 145 146 oItem.find('form#form'+filterId).on(submitType,function() { 147 148 var form = $(this); 149 var items = new Array(); 150 151 // Formularfelder durchlaufen und in den items array hinzufügen 152 $('form#form'+filterId+' input.filter,form#form'+filterId+' select.filter,form#form'+filterId+' .filterColumn input').each(function(){ 153 154 if ($(this).val()) { 155 var item = { 156 field: $(this).attr('name'), 157 type: "=", 158 value: $(this).val() 159 }; 160 items.push(item); 161 } 162 });
163 164 165 tabulator[id].setFilter(items); 166 167 //tabulator.setData 168 169 return false; 170 171 }) 172 173 return false; 174 175 } 176 177 var initTabulator = function(oItem) { 178 179 var productDataSource = oItem.attr('productDataSource'); 180 181 var vmbProductDataTable = new Tabulator('#'+oItem.attr('id'), { 182 183 height:'auto', 184 185 groupBy: tableGroupColumn, 186 187 //ajaxURL:productDataSource, //ajax URL 188 ajaxSorting:true, 189 ajaxFiltering:true, 190 ajaxLoaderLoading:"<span>Loading Data</span>", 191 selectable:false, 192 resizableColumns:false, 193 194 //layout:"fitColumns", 195 layout:"fitDataFill", 196 responsiveLayout:"collapse", 197 responsiveLayoutCollapseStartOpen:false, 198 responsiveLayoutCollapseUseFormatters:true, 199 responsiveLayoutCollapseFormatter:function(data){ 200 201 //data - an array of objects containing the column title and value for each cell 202 var table = document.createElement("table"); 203 204 205 206 207 data.forEach(function(col){ 208 209 if(typeof(col.value) != "undefined") { 210 211 var tr = document.createElement("tr"); 212 var td = document.createElement("td"); 213 td.innerHTML = "<strong>" + col.title.replace('-<br>', '') + "</strong>"; 214 tr.appendChild(td); 215 216 var td = document.createElement("td"); 217 if(typeof(col.value) == 'object') { 218 td.appendChild(col.value); 219 } else { 220 td.innerHTML = col.value; 221 } 222 223 tr.appendChild(td); 224 225 table.appendChild(tr); 226 } 227 228 229 }); 230 231 $( '.InitFancyBox:not(.Initialised)' ).each( CustomJs.InitFancybox ); 232 233 234 return Object.keys(data).length ? table : ""; 235 }, 236 //autoResize:true, 237 autoResize:false, 238 columns: columConfigurations[oItem.attr('id')], 239 /* 240 renderComplete :function(data){ 241 242 // Init Base Fancy Box 243 console.log('test2'); 244 BaseApp.FancyBoxInit(); 245 246 // Fancybox initialisieren 247 $( '.InitFancyBox:not(.Initialised)' ).each( CustomJs.InitFancybox ); 248 249 // Time Out 250 window.setTimeout( function(){ 251 252 // Init Base Fancy Box 253 BaseApp.FancyBoxInit(); 254 255 // Fancybox initialisieren 256 $( '.InitFancyBox:not(.Initialised)' ).each( CustomJs.InitFancybox ); 257 258 },300 ); 259 }, 260 261 */ 262 dataFiltered:function(filters, rows){ 263 //filters - array of filters currently applied 264 //rows - array of row components that pass the filters 265 // Init Base Fancy Box 266 BaseApp.FancyBoxInit(); 267 268 // Fancybox initialisieren 269 $( '.InitFancyBox:not(.Initialised)' ).each( CustomJs.InitFancybox ); 270 271 // Time Out 272 window.setTimeout( function(){ 273 274 // Init Base Fancy Box 275 BaseApp.FancyBoxInit(); 276 277 // Fancybox initialisieren 278 $( '.InitFancyBox:not(.Initialised)' ).each( CustomJs.InitFancybox ); 279 280 },300 ); 281 }, 282 }); 283 284 // Daten setzen 285 vmbProductDataTable.setData(productDataSource, {}, "post"); 286 287 return vmbProductDataTable; 288 289 } 290 291 } 292 293 294 295 296 297 298 }; 299 300 301/**************************************************************************************************************************************/ 302/* Init */ 303/**************************************************************************************************************************************/ 304 jQuery(document).ready(function() { 305 306 // BaseApp Int 307 CustomJs.Init(); 308 309 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.