UFO-Level-1/static/js/app.js
// Complete the event handler function for the form
Complete the event handler function for the form
Complete the event handler function for the form
function runEnter() {
  d3.event.preventDefault();
  var inputElement = d3.select("#datetime");
  var inputValue = inputElement.property("value");
  console.log(inputValue);
  var filteredData = tableData.filter(tableData => tableData.datetime === inputValue);
  console.log(filteredData);
    tbody.html("");
    filteredData.forEach(function(UFOReport) {
        console.log(UFOReport);
        var row = tbody.append("tr");
        Object.entries(UFOReport).forEach(function([key, value]) {
        console.log(key, value);
        var cell = row.append("td");
        cell.text(value);
    });
});
}
function runEnter ( ) { d3 . event . preventDefault ( ) ; var inputElement = d3 . select ( "#datetime" ) ; var inputValue = inputElement . property ( "value" ) ; console . log ( inputValue ) ; var filteredData = tableData . filter ( tableData => tableData . datetime === inputValue ) ; console . log ( filteredData ) ; tbody . html ( "" ) ; filteredData . forEach ( function ( UFOReport ) { console . log ( UFOReport ) ; var row = tbody . append ( "tr" ) ; Object . entries ( UFOReport ) . forEach ( function ( [ key , value ] ) { console . log ( key , value ) ; var cell = row . append ( "td" ) ; cell . text ( value ) ; } ) ; } ) ; }
Complete the event handler function for the form
Complete the event handler function for the form
// Prevent the page from refreshing // Select the input element and get the raw HTML node // Get the value property of the input element //   rebuild table using filter data // Step 1: Loop Through `data` and console.log each UFO Report object // Step 2:  Use d3 to append one table row `tr` for each UFO Report object // Don't worry about adding cells or text yet, just try appending the `tr` elements. // Step 3:  Use `Object.entries` to console.log each UFO Report value // Step 4: Use d3 to append 1 cell per UFO report value (date, city, state, country, shape, duration, comments) // Step 5: Use d3 to update each cell's text with // UFO report values (date, city, state, country, shape, duration, comments)