$(function () {
//variables
let uniqueCategoriesSet = new Set();
let uniqueCategories = [];
//for each produc get the category
northwindProducts.forEach(function (product) {
uniqueCategoriesSet.add(product.CategoryName)
});
//add first item all
uniqueCategories.push('All');
//get only unique categories
uniqueCategoriesSet.forEach(function (item) {
uniqueCategories.push(item);
});
//define a custom editor provider that extends the EditorProviderCombo class
$.ig.CustomComboEditorProvider = $.ig.CustomComboEditorProvider || $.ig.EditorProviderCombo.extend({
setSize: function (width, height) {
this.editor.element.css({
width: width,
height: height
});
},
getValue: function () {
//it goes through the selected options and if there is an option all selected, all elements are selected
for(let i = 0; i < this.editor.value().length; i++){
if(this.editor.value()[i] === "All"){
this.editor.selectAll();
}
}
return this.editor.value();
},
destroy: function () {
this.editor.element.remove();
}
});
//creathe the grid
$("#grid").igGrid({
autoGenerateColumns: false,
width: '100%',
height: '500px',
//creathe the columns
columns: [
{ headerText: "Product Name", key: "ProductName", dataType: "string" },
{ headerText: "Units In Stock", key: "InStock", dataType: "number" },
{ headerText:...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.