JSFiddle - React, Tailwind, and code Playground

by Rituja Veer

HTML

<link rel="stylesheet" href="https://github.com/mleibman/SlickGrid/blob/master/slick-default-theme.css">
<script src="https://github.com/mleibman/SlickGrid/blob/master/slick.grid.js"></script>
<script src="https://github.com/mleibman/SlickGrid/blob/master/slick.core.js"></script>
<script src="https://github.com/mleibman/SlickGrid/blob/master/slick.dataview.js"></script>
<link rel="stylesheet" href="https://github.com/mleibman/SlickGrid/blob/master/slick.grid.css">
<script src="https://github.com/mleibman/SlickGrid/tree/master/css/smoothness"></script>
<script src="https://github.com/mleibman/SlickGrid/tree/master/examples"></script>

  
<body>
<table width="100%">
  <tr>
    <td valign="top" width="50%">
      <div id="myGrid" style="width:600px;height:500px;"></div>
    </td>
    <td valign="top">
      <h2>Demonstrates:</h2>
      <ul>
        <li>basic grid with minimal configuration</li>
      </ul>
        <h2>View Source:</h2>
        <ul>
            <li><A href="https://github.com/mleibman/SlickGrid/blob/gh-pages/examples/example1-simple.html" target="_sourcewindow"> View the source for this example on Github</a></li>
        </ul>
    </td>
  </tr>
</table>

CSS

<style type="text/css">
  
  
  .selected {
border-right-color: silver;
 border-right-style: solid;
 background: #f5f5f5;
color: gray;
 font-size: 10px;
}

  
  
  
  
  </style>

JavaScript

var grid;
  var columns = [
    {id: 0, name: "Title", field: "title"},
    {id: 1, name: "Duration", field: "duration",behavior:"select"},
    {id: 2, name: "% Complete", field: "percentComplete"},
    {id: 3, name: "Start", field: "start"},
    {id: 4, name: "Finish", field: "finish"},
    {id: 5, name: "Effort Driven", field: "effortDriven"}
  ];

  var options = {
    enableCellNavigation: true,
    enableColumnReorder: false
  };

  $(function () {
    var data = [];
    for (var i = 0; i < 500; i++) {
      data[i] = {
        title: "Task " + i,
        duration: "5 days",
        percentComplete: Math.round(Math.random() * 100),
        start: "01/01/2009",
        finish: "01/05/2009",
        effortDriven: (i % 5 == 0)
      };
    }
    
    
 grid = new Slick.Grid("#myGrid", data, columns, options);
    
    grid.onHeaderClick.subscribe(function(e, args) {
        var columnID = args.column.id;
        for(var i = 0; i < grid.getDataLength(); i++){
                        $(grid.getCellNode(i,columnID)).toggleClass('selected');
        }
        
   
        
});
    
    
    
  })