JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<script src="http://www.jeasyui.com/easyui/datagrid-scrollview.js"></script>
<input id="cg">
JavaScript
var rows = [];
for(var i=1; i<=8000; i++){
var amount = Math.floor(Math.random()*1000);
var price = Math.floor(Math.random()*1000);
rows.push({
inv: 'Inv No '+i,
date: $.fn.datebox.defaults.formatter(new Date()),
name: 'Name '+i,
amount: amount,
price: price,
cost: amount*price,
note: 'Note '+i
});
}
$('#cg').combogrid({
panelWidth: 500,
idField: 'inv',
textField: 'name',
data: rows,
method: 'get',
view: scrollview,
pageSize: 50,
columns: [[
{field:'inv',title:'Inv',width:100},
{field:'date',title:'Date',width:100},
{field:'name',title:'Name',width:100,align:'right'},
{field:'amount',title:'Amount',width:80,align:'right'},
{field:'price',title:'Price',width:80,align:'right'},
{field:'cost',title:'Cost',width:80,align:'right'}
]],
fitColumns: true,
filter: function(q, row){
var opts = $(this).combogrid('options');
if ($.isEmptyObject(row)){return true;}
return row[opts.textField].toLowerCase().indexOf(q.toLowerCase()) == 0;
},
onChange: function(value){
setTimeout(function(){
var opts = $('#cg').combogrid('options');
opts.textValue = $('#cg').combogrid('getText');
},0);
},
onLoadSuccess:function(){
var opts = $('#cg').combogrid('options');
$('#cg').combogrid('setText', opts.textValue);
}
})