Hi. I am new to web development and jQuery and would greatly appreciate your help.
I have a website that displays live information for clients, which is the code below, however I would like to add the layout and data/information to a queue (or anything similar) to load it dynamically (so that the data loads in order rather than randomly or all at once) because at the moment it loads it all in one go, and the data then gets displayed whichever finishes loading first.
Code:
- function initPage() {
- var IfrRef = document.getElementById('parentId');
- var tWidth = (cellWidth==0)?findXValue:(cellWidth * numOfCols);
- IfrRef.style.width = tWidth;
- var tHeight = (cellHeight==0)?(findYValue-45):(cellHeight * numOfRows);
- IfrRef.style.height = tHeight;
- if(cellWidth == 0 && (tHeight > (findYValue-45))) { //vert scrollbar appearing, so reduce the width to accomodate it
- IfrRef.style.width = tWidth - 10;
- }
- if(cellHeight == 0 && (tWidth > findXValue)) { //hori scrollbar appearing, so reduce the height to accomodate it
- IfrRef.style.height = tHeight - 10;
- }
- var parentLayoutPattern, innerLayoutPattern;
- switch(numOfRows){
- case 1: parentLayoutPattern = "1C"; break;
- case 2: parentLayoutPattern = "2E"; break;
- case 3: parentLayoutPattern = "3E"; break;
- case 4: parentLayoutPattern = "4E"; break;
- case 5: parentLayoutPattern = "5E"; break;
- }
- switch(numOfCols){
- case 1: innerLayoutPattern = "1C"; break;
- case 2: innerLayoutPattern = "2U"; break;
- case 3: innerLayoutPattern = "3W"; break;
- case 4: innerLayoutPattern = "4W"; break;
- case 5: innerLayoutPattern = "5W"; break;
- }
- if(!parentLayoutPattern || !innerLayoutPattern){
- alert("Please define rows and columns between 1 and 5");
- return false;
- }
- dhxLayout = new dhtmlXLayoutObject(document.getElementById("parentId"), parentLayoutPattern, dhtmlSkin);
- dhxLayout.progressOn();
- setLayoutDefaults(numOfRows, dhxLayout, false, false, 0);
- var parentCell = "a"; //I believe this displays the layout until line 47
- for(var j=0; j<numOfRows; j++){
- dhxLayoutArr[j] = dhxLayout.cells(parentCell).attachLayout(innerLayoutPattern,dhtmlSkin)
- setLayoutDefaults(numOfCols,dhxLayoutArr[j], true, true, j)
- switch(parentCell){
- case "a": parentCell = "b"; break;
- case "b": parentCell = "c"; break;
- case "c": parentCell = "d"; break;
- case "d": parentCell = "e"; break;
- }
- }
- dhxLayout.progressOff();
- layoutIndexArr.clear();
- layoutIndexCell.clear();
- for(j=0; j<numOfRows; j++){ //I believe these lines display the data in the layout
- loadChartsForRow(numOfCols,dhxLayoutArr[j], j) //as stated above
- }
- }
I have tried various methods but had no luck.
Thank you for all your help, it is greatly appreciated.