document.addEventListener("DOMContentLoaded", function() { var grid = new FancyGrid({ tbar: [{ type: 'combo', emptyText: 'Select Group', data: [{ index: 0, column: '' }, { index: 1, column: 'Brand' }, { index: 2, column: 'Model' }, { index: 3, column: 'Engine' }, { index: 4, column: 'Transmission' }, { index: 5, column: 'HP' }, { index: 6, column: 'Fuel' }, { index: 7, column: 'Drive' }, { index: 8, column: 'Manufactured' }, { index: 9, column: 'Shade' }, { index: 10, column: 'Price' }], displayKey: 'column', valueKey: 'index', width: 120, value: 1, editable: false, subSearch: false, events: [{ change: function(field, value) { var item = field.data[value]; value = Number(value); switch (value) { case 0: grid.clearGroup(); break; case 9: grid.addGroup('color', true); break; default: grid.addGroup(item.column.toLocaleLowerCase(), true); } } }] }], renderTo: 'container', width: 900, height: 650, theme: 'extra-gray', selModel: { type: 'rows', activeCell: true }, trackOver: true, filter: true, grouping: { by: 'brand' }, data: data, defaults: { resizable: true, sortable: true, width: 95, align: 'center', cellAlign: 'center' }, columns: [{ type: 'order' }, { index: 'brand', title: 'Brand' }, { index: 'model', title: 'Model' }, { index: 'engine', title: 'Engine' }, { index: 'transmission', title: 'Transmission' }, { index: 'hp', title: 'HP' }, { index: 'fuel', title: 'Fuel' }, { index: 'drive', title: 'Drive' }, { index: 'manufactured', title: 'Manufactured' }, { index: 'color', title: 'Shade' }, { index: 'price', title: 'Price', type: 'currency' }] }); }); var data = [{ brand: 'Toyota', model: 'RAV4', drive: '2WD', transmission: 'Manual', engine: '2.0', hp: 149, fuel: 'Petrol', price: 23500, manufactured: 'Japan', color: 'White' }, { brand: 'Toyota', model: 'RAV4', drive: '2WD', transmission: 'Manual', engine: '2.4', hp: 199, fuel: 'Petrol', price: 39000, manufactured: 'Japan', color: 'White' }, { brand: 'Toyota', model: 'Fortuner', drive: '4WD', transmission: 'Manual', engine: '2.7', hp: 166, fuel: 'Petrol', price: 31000, manufactured: 'Japan', color: 'White' }, { brand: 'KIA', model: 'Sorento', drive: '4WD', transmission: 'Auto', engine: '2.2', hp: 200, fuel: 'Diesel', price: 35000, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Sorento', drive: '4WD', transmission: 'Auto', engine: '2.4', hp: 188, fuel: 'Petrol', price: 33000, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Sorento', drive: '4WD', transmission: 'Auto', engine: '2.2', hp: 150, fuel: 'Diesel', price: 36100, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Rio', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 123, fuel: 'Petrol', price: 12000, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Seltos', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 149, fuel: 'Petrol', price: 25900, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Seltos', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 149, fuel: 'Petrol', price: 19700, manufactured: 'South Korea', color: 'White' }, { brand: 'KIA', model: 'Optima', drive: '2WD', transmission: 'Auto', engine: '2.4', hp: 188, fuel: 'Petrol', price: 28500, manufactured: 'South Korea', color: 'Black' }, { brand: 'KIA', model: 'Cerato', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 128, fuel: 'Petrol', price: 18400, manufactured: 'South Korea', color: 'Metallic' }, { brand: 'KIA', model: 'Cerato', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 21500, manufactured: 'South Korea', color: 'White' }, { brand: 'KIA', model: 'Stinger', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 247, fuel: 'Petrol', price: 42070, manufactured: 'South Korea', color: 'White' }, { brand: 'Toyota', model: 'Corolla', drive: '2WD', transmission: 'Manual', engine: '1.6', hp: 122, fuel: 'Petrol', price: 19500, manufactured: 'Japan', color: 'Red' }, { brand: 'Toyota', model: 'Camry', drive: '2WD', transmission: 'Manual', engine: '2.5', hp: 181, fuel: 'Petrol', price: 27000, manufactured: 'Japan', color: 'White' }, { brand: 'KIA', model: 'Sportage', drive: '2WD', transmission: 'Manual', engine: '2.0', hp: 150, fuel: 'Petrol', price: 20000, manufactured: 'South Korea', color: 'White' }, { brand: 'KIA', model: 'Sportage', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 24000, manufactured: 'South Korea', color: 'Gray' }, { brand: 'KIA', model: 'Soul', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 123, fuel: 'Petrol', price: 16500, manufactured: 'South Korea', color: 'White' }, { brand: 'Toyota', model: 'Fortuner', drive: '4WD', transmission: 'Manual', engine: '2.7', hp: 177, fuel: 'Diesel', price: 39000, manufactured: 'Japan', color: 'Gray' }, { brand: 'Toyota', model: 'Land Cruiser', drive: '4WD', transmission: 'Auto', engine: '4.5', hp: 249, fuel: 'Diesel', price: 72000, manufactured: 'Japan', color: 'Gray' }, { brand: 'Toyota', model: 'Land Cruiser', drive: '4WD', transmission: 'Auto', engine: '2.7', hp: 163, fuel: 'Diesel', price: 43000, manufactured: 'Japan', color: 'Black' }, { brand: 'Toyota', model: 'Land Cruiser', drive: '4WD', transmission: 'Auto', engine: '2.8', hp: 177, fuel: 'Diesel', price: 48500, manufactured: 'Japan', color: 'White' }, { brand: 'Toyota', model: 'Land Cruiser', drive: '4WD', transmission: 'Auto', engine: '2.8', hp: 177, fuel: 'Diesel', price: 55700, manufactured: 'Japan', color: 'Black' }, { brand: 'Toyota', model: 'Hilux', drive: '4WD', transmission: 'Manual', engine: '2.4', hp: 150, fuel: 'Diesel', price: 34000, manufactured: 'Japan', color: 'White' }, { brand: 'Toyota', model: 'Hilux', drive: '4WD', transmission: 'Manual', engine: '2.4', hp: 150, fuel: 'Diesel', price: 32000, manufactured: 'Japan', color: 'White' }, { brand: 'Toyota', model: 'Highlander', drive: '4WD', transmission: 'Auto', engine: '3.5', hp: 249, fuel: 'Petrol', price: 47500, manufactured: 'Japan', color: 'Gray' }, { brand: 'Toyota', model: 'Highlander', drive: '4WD', transmission: 'Auto', engine: '3.5', hp: 249, fuel: 'Petrol', price: 49000, manufactured: 'Japan', color: 'Gray' }, { brand: 'Toyota', model: 'Highlander', drive: '4WD', transmission: 'Auto', engine: '3.5', hp: 249, fuel: 'Petrol', price: 51000, manufactured: 'Japan', color: 'Gray' }, { brand: 'VW', model: 'Tourage', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Diesel', price: 63000, manufactured: 'Germany', color: 'Dark' }, { brand: 'VW', model: 'Polo', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 110, fuel: 'Petrol', price: 12700, manufactured: 'Germany', color: 'Gray' }, { brand: 'VW', model: 'Polo', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 110, fuel: 'Petrol', price: 13200, manufactured: 'Germany', color: 'Dark' }, { brand: 'VW', model: 'Passat', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Petrol', price: 34900, manufactured: 'Germany', color: 'Gray' }, { brand: 'VW', model: 'Tiguan', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 150, fuel: 'Petrol', price: 25900, manufactured: 'Germany', color: 'Metallic' }, { brand: 'VW', model: 'Tiguan', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 180, fuel: 'Petrol', price: 34500, manufactured: 'Germany', color: 'White' }, { brand: 'VW', model: 'Teramont', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 200, fuel: 'Petrol', price: 53000, manufactured: 'Germany', color: 'Black' }, { brand: 'VW', model: 'Jetta', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 110, fuel: 'Petrol', price: 21900, manufactured: 'Germany', color: 'Metallic' }, { brand: 'VW', model: 'Passat', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Petrol', price: 42000, manufactured: 'Germany', color: 'Pearl' }, { brand: 'VW', model: 'Tourage', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Petrol', price: 64300, manufactured: 'Germany', color: 'Pearl' }, { brand: 'VW', model: 'Tourage', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Petrol', price: 65200, manufactured: 'Germany', color: 'Metallic' }, { brand: 'VW', model: 'Passat', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 150, fuel: 'Petrol', price: 32500, manufactured: 'Germany', color: 'Blue' }, { brand: 'Mazda', model: 'CX-5', drive: '2WD', transmission: 'Manual', engine: '2.0', hp: 150, fuel: 'Petrol', price: 21800, manufactured: 'Japan', color: 'Gray' }, { brand: 'Mazda', model: 'CX-5', drive: '2WD', transmission: 'Manual', engine: '2.0', hp: 150, fuel: 'Petrol', price: 21800, manufactured: 'Japan', color: 'Blue' }, { brand: 'VW', model: 'Polo', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 110, fuel: 'Petrol', price: 12800, manufactured: 'Germany', color: 'Dark' }, { brand: 'VW', model: 'Tiguan', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 150, fuel: 'Petrol', price: 27000, manufactured: 'Germany', color: 'White' }, { brand: 'VW', model: 'Tiguan', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 180, fuel: 'Petrol', price: 36400, manufactured: 'Germany', color: 'Gray' }, { brand: 'VW', model: 'Tiguan', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 32500, manufactured: 'Germany', color: 'Gray' }, { brand: 'Mazda', model: 'CX-5', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 24800, manufactured: 'Japan', color: 'White' }, { brand: 'Mazda', model: '3', drive: '2WD', transmission: 'Auto', engine: '1.5', hp: 120, fuel: 'Petrol', price: 23300, manufactured: 'Japan', color: 'Black' }, { brand: 'Mazda', model: '6', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 22700, manufactured: 'Japan', color: 'Black' }, { brand: 'Mazda', model: '6', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 24100, manufactured: 'Japan', color: 'Gray' }, { brand: 'Mazda', model: 'CX-9', drive: '4WD', transmission: 'Auto', engine: '2.5', hp: 231, fuel: 'Petrol', price: 40700, manufactured: 'Japan', color: 'White' }, { brand: 'Mazda', model: 'CX-9', drive: '4WD', transmission: 'Auto', engine: '2.5', hp: 231, fuel: 'Petrol', price: 46000, manufactured: 'Japan', color: 'Red' }, { brand: 'Mazda', model: 'CX-9', drive: '4WD', transmission: 'Auto', engine: '2.5', hp: 231, fuel: 'Petrol', price: 49700, manufactured: 'Japan', color: 'Gray' }, { brand: 'Skoda', model: 'Rapid', drive: '2WD', transmission: 'Auto', engine: '1.6', hp: 110, fuel: 'Petrol', price: 13800, manufactured: 'Czech', color: 'White' }, { brand: 'Skoda', model: 'Octavia', drive: '2WD', transmission: 'Auto', engine: '1.8', hp: 180, fuel: 'Petrol', price: 22700, manufactured: 'Czech', color: 'White' }, { brand: 'Skoda', model: 'Octavia', drive: '4WD', transmission: 'Auto', engine: '1.4', hp: 150, fuel: 'Petrol', price: 28100, manufactured: 'Czech', color: 'Black' }, { brand: 'Skoda', model: 'Octavia', drive: '2WD', transmission: 'Auto', engine: '1.8', hp: 180, fuel: 'Petrol', price: 24700, manufactured: 'Czech', color: 'White' }, { brand: 'Skoda', model: 'Karoq', drive: '2WD', transmission: 'Auto', engine: '1.4', hp: 150, fuel: 'Petrol', price: 26300, manufactured: 'Czech', color: 'Gray' }, { brand: 'Skoda', model: 'Kodiaq', drive: '2WD', transmission: 'Manual', engine: '1.4', hp: 125, fuel: 'Petrol', price: 23400, manufactured: 'Czech', color: 'Black' }, { brand: 'Mazda', model: 'CX-5', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 24800, manufactured: 'Japan', color: 'White' }, { brand: 'Mazda', model: '3', drive: '2WD', transmission: 'Auto', engine: '1.5', hp: 120, fuel: 'Petrol', price: 22700, manufactured: 'Japan', color: 'Gray' }, { brand: 'Mazda', model: '3', drive: '2WD', transmission: 'Auto', engine: '1.5', hp: 120, fuel: 'Petrol', price: 22700, manufactured: 'Japan', color: 'Blue' }, { brand: 'Mazda', model: '3', drive: '2WD', transmission: 'Auto', engine: '1.5', hp: 120, fuel: 'Petrol', price: 23500, manufactured: 'Japan', color: 'Red' }, { brand: 'BMW', model: 'X7', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 340, fuel: 'Petrol', price: 98700, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: 'X4', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 62100, manufactured: 'Germany', color: 'White' }, { brand: 'BMW', model: '520d', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 56000, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: '520d', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 56000, manufactured: 'Germany', color: 'White' }, { brand: 'BMW', model: 'X4', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 62100, manufactured: 'Germany', color: 'White' }, { brand: 'BMW', model: '320i', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 184, fuel: 'Petrol', price: 48400, manufactured: 'Germany', color: 'Gray' }, { brand: 'BMW', model: 'X1', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 192, fuel: 'Petrol', price: 44000, manufactured: 'Germany', color: 'Light Blue' }, { brand: 'BMW', model: '530d', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Diesel', price: 70400, manufactured: 'Germany', color: 'Gray Metallic' }, { brand: 'BMW', model: '730d', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Diesel', price: 102800, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: 'X1', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 192, fuel: 'Petrol', price: 42200, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: 'X3', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 58800, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: '218i', drive: '2WD', transmission: 'Auto', engine: '1.5', hp: 140, fuel: 'Petrol', price: 31300, manufactured: 'Germany', color: 'Black' }, { brand: 'BMW', model: 'X3', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 190, fuel: 'Diesel', price: 59100, manufactured: 'Germany', color: 'White' }, { brand: 'BMW', model: 'X7', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249, fuel: 'Diesel', price: 110571, manufactured: 'Germany', color: 'White' }, { brand: 'Land Rover', model: 'RANGE ROVER L405', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249.4, fuel: 'Diesel', price: 117500, manufactured: 'UK', color: 'Blue' }, { brand: 'Land Rover', model: 'RANGE ROVER L405', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249.5, fuel: 'Diesel', price: 117800, manufactured: 'UK', color: 'Black' }, { brand: 'Land Rover', model: 'RANGE ROVER L405', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249.5, fuel: 'Diesel', price: 119200, manufactured: 'UK', color: 'White' }, { brand: 'Land Rover', model: 'RANGE ROVER L405', drive: '4WD', transmission: 'Auto', engine: '4.4', hp: 340, fuel: 'Diesel', price: 152400, manufactured: 'UK', color: 'Light Brown' }, { brand: 'Land Rover', model: 'Range Rover Sport', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249.5, fuel: 'Diesel', price: 100500, manufactured: 'UK', color: 'White' }, { brand: 'Land Rover', model: 'Range Rover Sport', drive: '4WD', transmission: 'Auto', engine: '3.0', hp: 249.4, fuel: 'Diesel', price: 101500, manufactured: 'UK', color: 'Black' }, { brand: 'Land Rover', model: 'RANGE ROVER EVOQUE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 199.8, fuel: 'Petrol', price: 57500, manufactured: 'UK', color: 'Black' }, { brand: 'Land Rover', model: 'RANGE ROVER EVOQUE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 149.8, fuel: 'Diesel', price: 60300, manufactured: 'UK', color: 'Gray' }, { brand: 'Land Rover', model: 'DISCOVERY SPORT', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 179.5, fuel: 'Diesel', price: 53000, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'E-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 149.5, fuel: 'Diesel', price: 46642, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'E-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 149.4, fuel: 'Diesel', price: 48700, manufactured: 'UK', color: 'Red' }, { brand: 'Jaguar', model: 'E-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 199.5, fuel: 'Petrol', price: 55228, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'F-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 179.5, fuel: 'Petrol', price: 55828, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'F-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 179.5, fuel: 'Diesel', price: 57385, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'F-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 179.5, fuel: 'Diesel', price: 57457, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'XF', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 199.5, fuel: 'Petrol', price: 57457, manufactured: 'UK', color: 'Black' }, { brand: 'Jaguar', model: 'XF', drive: '2WD', transmission: 'Auto', engine: '2.0', hp: 179.5, fuel: 'Diesel', price: 58700, manufactured: 'UK', color: 'Red' }, { brand: 'Jaguar', model: 'I-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 233.9, fuel: 'Electro', price: 103742, manufactured: 'UK', color: 'Brown' }, { brand: 'Jaguar', model: 'I-PACE', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 233.9, fuel: 'Electro', price: 109557, manufactured: 'UK', color: 'Gray' }, { brand: 'Lexus', model: 'NX 200', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 38857, manufactured: 'Japan', color: 'Gray' }, { brand: 'Lexus', model: 'NX 200', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 42821, manufactured: 'Japan', color: 'White' }, { brand: 'Lexus', model: 'UX', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 31428, manufactured: 'Japan', color: 'Brown' }, { brand: 'Lexus', model: 'UX', drive: '4WD', transmission: 'Auto', engine: '2.0', hp: 150, fuel: 'Petrol', price: 36214, manufactured: 'Japan', color: 'Green' }, { brand: 'Lexus', model: 'LX 450D', drive: '4WD', transmission: 'Auto', engine: '4.5', hp: 272, fuel: 'Diesel', price: 94971, manufactured: 'Japan', color: 'Blue' }, { brand: 'Lexus', model: 'LX 450D', drive: '4WD', transmission: 'Auto', engine: '4.5', hp: 272, fuel: 'Diesel', price: 94971, manufactured: 'Japan', color: 'Light Gray' } ];
<script src="https://cdn.fancygrid.com/fancy.min.js"></script> <div id="container"></div>