JSFiddle - React, Tailwind, and code Playground

by jabbad

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-3-typeahead/4.0.2/bootstrap3-typeahead.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div id="example1" class="hot handsontable htColumnHeaders"></div>

CSS

</style><!-- Ugly Hack due to jsFiddle issue -->

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/handsontable.full.min.css">

JavaScript

var myEditor = Handsontable.editors.TextEditor.prototype.extend();      

        myEditor.prototype.beginEditing = function () {          
            this.TEXTAREA.value = this.originalValue;
            $(this.TEXTAREA).typeahead("destroy");
            IniTypeahead(this.TEXTAREA, this.originalValue);         
            Handsontable.editors.TextEditor.prototype.beginEditing.apply(this, arguments);
        }



function getCarData() {
    return [
      ["Tesla", 2017, "black", "black"],
      ["Nissan", 2018, "blue", "blue"],
      ["Chrysler", 2019, "yellow", "black"],
      ["", ,"" , ""]
    ];
  }
  var
    container = document.getElementById('example1'),
    hot;
  
  hot = new Handsontable(container, {
    data: getCarData(),
    colHeaders: ['Car', 'Year', 'Chassis color', 'Bumper color'],
    columns: [
      {editor:  myEditor},
      {type: 'numeric'},
      {
        type: 'dropdown',
        source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'white']
      },
      {
        type: 'dropdown',
        source: ['yellow', 'red', 'orange', 'green', 'blue', 'gray', 'black', 'white']
      }
    ]
  });
  
function IniTypeahead(control, value)
  {
  $(control).typeahead({
     highlight: false,
        hint: false,
        cache: false,
    source:  ["Afghanistan", "Albania", "Algeria", "Andorra"]
});
  }