<commit_before>var React = require('react');
var data  = require('./data.full.js');
var options = {
  rowHeight: 76
};

var ReactDataTable = React.createClass({
  getInitialState: function() {
    return {
      rowsToDisplay: {
        toHideAbove: 0,
        toRender: 0,
        toHideBelow: 0
      }
    };
  },
  render: function() {
    var createCell = function createCell (key, value) {
      return <td key={key}>{value}</td>;
    };

    var createRow = function createRow (row) {
      return (
        <tr key={row._id}>{
          Object.keys(row).map( function(key) {
            return createCell(key, row[key]);
          })
        }</tr>
      );
    };

    var createHeaderCell = function createHeaderCell (key) {
      return <th key={key}>{key}</th>;
    };

    var createTable = function createTable (table) {
      return (
        <table ref="table"><commit_msg>Add selective rendering logic to createTable function Display data and pad unrendered space to maintain correct scrollbars when element is mounted Display blank rows to fill space correctly when element is not mounted<commit_after>var React = require('react');
var data  = require('./data.full.js');
var options = {
  rowHeight: 76
};

var ReactDataTable = React.createClass({
  getInitialState: function() {
    return {
      rowsToDisplay: {
        toHideAbove: 0,
        toRender: 0,
        toHideBelow: 0
      }
    };
  },
  render: function() {
    var createCell = function createCell (key, value) {
      return <td key={key}>{value}</td>;
    };

    var createRow = function createRow (row) {
      return (
        <tr key={row._id}>{
          Object.keys(row).map( function(key) {
            return createCell(key, row[key]);
          })
        }</tr>
      );
    };

    var createHeaderCell = function createHeaderCell (key) {
      return <th key={key}>{key}</th>;
    };

    var createTable = function createTable (origTable) {
      if (this.isMounted()) {
        var table = origTable.slice(this.state.rowsToDisplay.toHideAbove);
        if (this.state.rowsToDisplay.toHideBelow) {
          table = table.slice(0,-this.state.rowsToDisplay.toHideBelow);
        }
        var paddingTop = this.state.rowsToDisplay.toHideAbove * this.props.options.rowHeight;
        var paddingBottom = this.state.rowsToDisplay.toHideBelow * this.props.options.rowHeight;
        var tableElement = this.refs.table.getDOMNode();
        tableElement.style.paddingTop = paddingTop +'px';
        tableElement.style.paddingBottom = paddingBottom +'px'
      } else {
        var table = origTable.map(function () {
          return {}
        });
      }
      return (
        <table ref="table">
{'fraction_non_alphanumeric': 0.12717834631071562, 'fraction_numerical': 0.004078605858361142, 'mean_word_length': 2.445721583652618, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3916587', 'n_tokens_mistral': 809, 'n_tokens_neox': 778, 'n_words': 190}