-
Notifications
You must be signed in to change notification settings - Fork 36
Gerald - Onboarding #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
geraldtivatyi
wants to merge
55
commits into
IMQS:master
Choose a base branch
from
geraldtivatyi:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 41 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
6e0a6ef
Create basic table with dummy data.
geraldtivatyi 7349923
create basis for interfaces and classes to handle and structure data …
geraldtivatyi 83bd5b0
Merge pull request #1 from geraldtivatyi/foundational-setup
geraldtivatyi 1b69e97
render table records and headings to html
geraldtivatyi 7f89a05
Some code refactoring.
geraldtivatyi a70d634
Make http request to get data from server.
geraldtivatyi 888df86
Update fetching data from server
geraldtivatyi 59f3d00
Add styling and fix bug
geraldtivatyi 68c6db2
Merge pull request #3 from geraldtivatyi/use-data-from-server
geraldtivatyi fa380a5
Merge pull request #2 from geraldtivatyi/rendering-to-html
geraldtivatyi 31961b5
Refactor code and add comments
geraldtivatyi 0c5f435
Merge pull request #4 from geraldtivatyi/code-refactoring
geraldtivatyi 2cd6d76
Edit code to meet code style requirements
geraldtivatyi 5c41aaf
Merge pull request #5 from geraldtivatyi/codestyle-javascript-style-g…
geraldtivatyi 0a3474b
fix navigation
geraldtivatyi d232ff5
fix navigation
geraldtivatyi 8403aae
add filters
geraldtivatyi 4c63762
fix filter bugs
geraldtivatyi 4e32a4f
fix filters and navigation
geraldtivatyi 5b98879
fix form filters
geraldtivatyi 445ed5c
Merge pull request #6 from geraldtivatyi/fix-navigation
geraldtivatyi 7fdc286
Update file names and refactor code
geraldtivatyi 44ea44e
Fix file names and refactor code
geraldtivatyi e2bad73
Merge pull request #7 from geraldtivatyi/code-refactoring
geraldtivatyi b8c3324
responsive screen size
geraldtivatyi c9bb2dd
fix unnecessary calls and rapid firing calls
geraldtivatyi d62f5e8
New updates
geraldtivatyi bc0f8c6
Implement promises
geraldtivatyi d153f62
Implementing promises
geraldtivatyi bcc469c
Promises and fetch updates
geraldtivatyi ad82237
Updates
geraldtivatyi 4b6e798
Update promises
geraldtivatyi 40ac37d
Finalise promises
geraldtivatyi 5615095
Updates - code refactoring
geraldtivatyi b24d3db
Code refactoring
geraldtivatyi e3ff6f0
Code refactoring
geraldtivatyi 7b8f169
Final code refactoring
geraldtivatyi 5178b2d
Merge pull request #8 from geraldtivatyi/new-updates
geraldtivatyi 8d910b0
Updates to js files
geraldtivatyi 8916976
Remove .js and .js.map files
geraldtivatyi 5526bd2
Remove empty file
geraldtivatyi 4060dce
Fixing code - comments
geraldtivatyi bf30acf
Fixing code - comments from code review
geraldtivatyi f63224e
Update code
geraldtivatyi 8dbaa7b
Reworked left and right arrow functions.
geraldtivatyi e71702c
Remove js import statements and
geraldtivatyi 8883bc6
Fix gitignore file
geraldtivatyi 2ca2f32
Updates
geraldtivatyi 2115eb4
Updates
geraldtivatyi 329ab1a
Updates
geraldtivatyi 1ab3ae1
Updates
geraldtivatyi 7378b6b
Updates
geraldtivatyi 59019f0
Updates
geraldtivatyi ebf4a49
Updates
geraldtivatyi be7b34a
Final updates
geraldtivatyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| /node_modules | ||
| /classes/*.js | ||
| /classes/*.js.map | ||
| /interfaces/*.js | ||
| /interfaces/*.js.map | ||
| app.js | ||
| app.js.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,309 @@ | ||
| import { TableHeadingString } from "./classes/table-headings.js"; | ||
| import { RenderTableRows } from "./classes/render-rows.js"; | ||
| import { RenderTableHeading } from "./classes/render-headings.js"; | ||
| import { HasFormatMethod } from "./interfaces/has-format-method.js"; | ||
|
|
||
| let numOfRows = getNumOfRows(); // Call function to get number of rows to render based on current screen size | ||
| let totalNumofRecords: number; // Declare public variable to store total number of records from the server | ||
|
|
||
| // Accessing form data from front end | ||
| let fromIDElement = document.querySelector('#fromID') as HTMLParagraphElement; | ||
| let toIDElement = document.querySelector('#toID') as HTMLParagraphElement; | ||
| let numofrecords = document.querySelector('#numofrecords') as HTMLParagraphElement; | ||
|
|
||
| // Initializing variables for first page of data | ||
| let fromID = 1; | ||
| let toID = numOfRows; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create initial page with initial data | ||
| createInitialPage(numOfRows); | ||
|
|
||
| // Listen for change in window size | ||
| let screenHeight = screen.height; | ||
| window.addEventListener('resize', function(event) { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| screenHeight = window.innerHeight; | ||
|
|
||
| // Change number of rows based on window size | ||
| if (screenHeight >= 750) { | ||
| numOfRows = 23; | ||
| } else if ((screenHeight < 750) && (screenHeight >= 550)) { | ||
| numOfRows = 18; | ||
| } else if ((screenHeight < 550) && (screenHeight >= 265)) { | ||
| numOfRows = 8; | ||
| } else if ((screenHeight < 265) && (screenHeight >= 95)) { | ||
| numOfRows = 3; | ||
| } else if (screenHeight < 95) { | ||
| numOfRows = 2; | ||
| } | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Recreate grid with new set number of rows | ||
| createInitialPage(numOfRows); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
| // Set a timeout to use for promises when navigating through data | ||
| let clickTimeout: ReturnType<typeof setTimeout>; | ||
|
|
||
| // When clicking on left arrow | ||
| $( "#leftarrow" ).on( "click", function() { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| // Clear the timeout every time if you navigate and you're not at the start ID of all the data | ||
| if (fromID != 1) { | ||
| clearTimeout(clickTimeout); | ||
| } | ||
|
|
||
| // Clear form value in front-end when navigating data using the arrows | ||
| let startfrom = document.querySelector("#startfrom") as HTMLInputElement; | ||
| startfrom.value = ""; | ||
|
|
||
| if ((fromID < (numOfRows-1)) && (fromID > 1)) { // If the "from" ID is within the IDs at the beginning of the dataset | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| fromID = 1; | ||
| toID = numOfRows; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
geraldtivatyi marked this conversation as resolved.
Outdated
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| // Promise.all<string>([headings, records]).then((values) => { | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| } else if (fromID === 1) { // If the "from" ID is 1 then set the values and do not make any backend calls | ||
| fromID = 1; | ||
| toID = numOfRows; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
| } else { // Else, continue creating table with the set IDs | ||
| fromID = fromID - (numOfRows-1); | ||
| toID = toID - (numOfRows-1); | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
| } | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
| // Listen for click on right arrow | ||
| $( "#rightarrow" ).on( "click", function() { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| // Clear the timeout every time if you navigate and you're not at the end ID of all the data | ||
| if (toID != totalNumofRecords) { | ||
| clearTimeout(clickTimeout); | ||
| } | ||
|
|
||
| // Clear form value in front-end when navigating data using the arrows | ||
| let startfrom = document.querySelector("#startfrom") as HTMLInputElement; | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| startfrom.value = ""; | ||
|
|
||
| if ((fromID > (totalNumofRecords-((numOfRows-1)*2)) ) && (fromID < totalNumofRecords) ) { // If the "from" ID is within the IDs at the ending of the dataset | ||
| fromID = (totalNumofRecords-(numOfRows-1)); | ||
| toID = totalNumofRecords; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
| } else if (toID === totalNumofRecords) { // If the "to" ID is the ending ID, then set the values and do not make any backend calls | ||
| fromID = (totalNumofRecords-(numOfRows-1)); | ||
| toID = totalNumofRecords; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
| } else { // Else, continue creating table with the set IDs | ||
| fromID = fromID + (numOfRows-1); | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toID = toID + (numOfRows-1); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
| } | ||
| }); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Listen for submission in form and use inputs to request data from backend | ||
| $( "#submit" ).on( "click", function() { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| // Clear the timeout every time if you submit on the form | ||
| clearTimeout(clickTimeout); | ||
|
|
||
| // Clear form value in from end when navigating data using the arrows | ||
| let startFromIDElement = document.querySelector('#startfrom') as HTMLInputElement; | ||
| let startFrom = startFromIDElement.valueAsNumber; | ||
|
|
||
| // Checks to see if you request invalid values in the form | ||
| if (startFrom < 1 || startFrom > (totalNumofRecords-(numOfRows-1))) { | ||
| alert("The acceptable range is between 1 and "+(totalNumofRecords-(numOfRows-1))); | ||
| return; | ||
| } else if (isNaN(startFrom)) { | ||
| alert("You have not set a value to submit."); | ||
| } else { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| fromID = startFrom; | ||
| toID = fromID + (numOfRows-1); | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
| // Listen for submission in form and use inputs to request data from backend | ||
| $( "#gotostart" ).on( "click", function() { | ||
| // Clear the timeout every time if you click to go to start of dataset | ||
| clearTimeout(clickTimeout); | ||
|
|
||
| // Clear form value in front-end when navigating data using the arrows | ||
| let startfrom = document.querySelector("#startfrom") as HTMLInputElement; | ||
| startfrom.value = ""; | ||
|
|
||
| // Set ID values to the start of the dataset | ||
| fromID = 1; | ||
| toID = numOfRows; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
|
|
||
| $( "#gotoend" ).on( "click", function() { | ||
| // Clear the timeout every time if you click to go to end of dataset | ||
| clearTimeout(clickTimeout); | ||
|
|
||
| // Clear form value in front-end when navigating data using the arrows | ||
| let startfrom = document.querySelector("#startfrom") as HTMLInputElement; | ||
| startfrom.value = ""; | ||
|
|
||
| // Set ID values to the end of the dataset | ||
| fromID = totalNumofRecords-(numOfRows-1); | ||
| toID = totalNumofRecords; | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function() { | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
|
|
||
| // Function to create table and render in browser | ||
| function generateTable(headingsStr: string, recordsStr: string) { | ||
| // Instantiate grid table to append innerHTML | ||
| let tble = new RenderTableHeading(document.querySelector('#table') as HTMLDivElement); | ||
|
|
||
| // Empty the table in the html | ||
| let emptyTable = document.querySelector('#table') as HTMLDivElement; | ||
| emptyTable.innerHTML = ""; // clear table to empty html | ||
|
|
||
| // Recreate table with new headings and records data | ||
| let interfaceHeading: HasFormatMethod; // variable of type interface used in creating table headings | ||
| let interfaceRecords: HasFormatMethod; // variable of type interface used in creating table rows | ||
| interfaceHeading = new TableHeadingString(headingsStr); // call method to generate string containing table heading element | ||
| tble.constructTableHeadings(interfaceHeading); // call method to render table headings element in browser | ||
| interfaceRecords = new RenderTableRows(recordsStr); // call method to generate string containing table row elements | ||
| } | ||
|
|
||
| // Function to target an element in html by its id | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| function el(s: string) { | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| return document.getElementById(s); | ||
| } | ||
|
|
||
| // Function to create the initial table when loading the page for the first time or when the window size changes | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| function createInitialPage(numOfRows: number) { | ||
| // Clear the timeout every time this function is called | ||
| clearTimeout(clickTimeout); | ||
|
|
||
| // Check if you're at the start or end of the data set, and reset IDs for change in window size | ||
| if (fromID > (totalNumofRecords-(numOfRows-1))) { | ||
| fromID = totalNumofRecords-(numOfRows-1); | ||
| toID = fromID + (numOfRows-1); | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| } else { | ||
| fromID = fromID; | ||
| toID = fromID + (numOfRows-1); | ||
| fromIDElement.innerHTML = fromID.toString(); | ||
| toIDElement.innerHTML = toID.toString(); | ||
| } | ||
|
|
||
| //Request for and set the total number of records | ||
| fetch("/recordCount").then(res => res.text()).then((value) => { | ||
| numofrecords.innerHTML = value; | ||
| totalNumofRecords = Number(value) - 1; | ||
| }).catch(err => console.log(err)) | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Create table using the new set IDs inside a set timeout | ||
| clickTimeout = setTimeout(function(){ | ||
| // Use resolved promises to fetch data from backend | ||
| let headings = Promise.resolve(fetch("/columns").then(res => res.text())); | ||
| let records = Promise.resolve(fetch("/records?from="+fromID+"&to="+toID).then(res => res.text())); | ||
| Promise.all<string>([headings, records]).then((values) => { | ||
| generateTable(values[0], values[1]); | ||
| }).catch(err => console.log(err)); | ||
| }, 500); | ||
|
geraldtivatyi marked this conversation as resolved.
Outdated
|
||
| } | ||
|
|
||
| // Function returning number of rows based on window size | ||
| function getNumOfRows() { | ||
| // Get height of screen | ||
| screenHeight = window.innerHeight; | ||
|
|
||
| // Checks to return correct value for number of rows | ||
| if (screenHeight >= 750) { | ||
| return 23; | ||
| } else if ((screenHeight < 750) && (screenHeight >= 550)) { | ||
| return 18; | ||
| } else if ((screenHeight < 550) && (screenHeight >= 265)) { | ||
| return 8; | ||
| } else if ((screenHeight < 265) && (screenHeight >= 95)) { | ||
| return 3; | ||
| } else if (screenHeight < 95) { | ||
| return 2; | ||
| } else { | ||
| return 23; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { HasFormatMethod } from "../interfaces/has-format-method.js"; | ||
|
|
||
| // Create table headings and render in browser | ||
| export class RenderTableHeading { | ||
| constructor(private container: HTMLDivElement) {} | ||
|
|
||
| constructTableHeadings(element: HasFormatMethod) { | ||
| let div = document.createElement('div'); | ||
| div.innerHTML = element.internalFormat(); | ||
| div.className = "tablecell"; | ||
| div.style.gridTemplateColumns = "repeat("+element.arrayLength()+", 1fr)"; | ||
|
|
||
| this.container.append(div); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import { HasFormatMethod } from "../interfaces/has-format-method.js"; | ||
|
|
||
| // generate html string for table rows data and render in browser | ||
| export class RenderTableRows implements HasFormatMethod { | ||
| private returnStr = ""; | ||
| private arrLength = 0; | ||
|
|
||
| constructor( recordsStr: string ){ | ||
| let table = document.querySelector('#table') as HTMLDivElement; // Target div element with ID table | ||
| let navigation = document.querySelector('#navigation') as HTMLDivElement; // Target div element with ID navigation | ||
| let myArr = JSON.parse(recordsStr); // Parse the string to create array of the data | ||
|
|
||
| // Edit styling of the table and navigation bar | ||
| table.style.display = "grid"; | ||
| table.style.gridTemplateRows = "repeat(auto-fill, "+(100/(myArr.length+2))+"%)"; | ||
| navigation.style.height = (100/(myArr.length+2))+"%"; | ||
|
|
||
| // Create innerHTML text to be rendered to front-end in the table div | ||
| for(let i=0;i<myArr.length;i++) { | ||
| for(let j=0;j<myArr[i].length;j++) { | ||
| this.arrLength = myArr[i].length; | ||
| this.returnStr += | ||
| "<div><p>"+myArr[i][j]+"</p></div>"; | ||
| } | ||
|
|
||
| // Append innerHTML text to div element in front-end | ||
| let div = document.createElement('div'); | ||
| div.innerHTML = this.returnStr; | ||
| div.className = "tablecell"; | ||
| div.style.gridTemplateColumns = "repeat("+this.arrLength+", 1fr)"; | ||
| table.append(div); | ||
| this.returnStr = ""; | ||
| } | ||
| } | ||
|
|
||
| // Returns length of array of headings to get number of columns necessary to render | ||
| arrayLength() { | ||
| return this.arrLength; | ||
| } | ||
|
|
||
| // Returns formatted string to be placed in html | ||
| internalFormat() { | ||
| return this.returnStr; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.