Since v9.2 the Grid component uses the WebAssembly-based library Json2Excel for exporting Grid data to an Excel file. As earlier, you can use either the public export server or a local export server.
From v9.2âThe link to the public export server is used by default, so you don't need to specify it. If you use your own export server, you need to install the Json2Excel library and provide the local path to the export module on your computer by setting the path to the worker.js file as "../libs/json2excel/1.3/worker.js?vx"
:
grid.export.xlsx({
url: "../libs/json2excel/1.3/worker.js?vx",
});
Up to v9.1â
The previously used export module server is still available for the Suite versions up to v9.1. You can either set the path to the public export server as:
grid.export.xlsx({
url: "//export.dhtmlx.com/excel"
});
or provide a local path to the export module on your computer as a value of the url
property of the export method.
The getSortingState()
method of Grid has been deprecated and replaced with the getSortingStates()
method of DataCollection and TreeCollection, which allows getting the result of sorting data by multiple columns.
From v9.1
grid.data.getSortingStates()[0];
8.4 -> 9.0â Grid/TreeGridâ TreeGrid as a Grid modeâ
Since v9.0 the TreeGrid component becomes a part of the Grid component. To enable the TreeGrid mode you need just to use the dhx.Grid
constructor and set the type: "tree"
property in the Grid configuration. This functionality is available in the PRO version.
Before v9.0
const treegrid = new dhx.TreeGrid("treegrid_container", {
columns: [
],
data: dataset
});
From v9.0
const grid = new dhx.Grid("grid_container", {
type: "tree",
columns: [
],
data: dataset
});
Data groupingâ
Since v9.0 the TreeGrid data grouping methods groupBy()
and ungroup()
, and the groupTitleTemplate
property have been deprecated. The data grouping functionality is now available via the group
configuration property of Grid.
From v9.0
const grid = new dhx.Grid("grid_container", {
group: true,
columns: [
],
data: dataset
});
This config enables the TreeGrid mode (the type:"tree"
configuration option is automatically set in the Grid configuration), allows configuring the data grouping settings and using DataCollection API for grouping Grid data.
Before v9.0 the content
property of the column header/footer could have the default statistical functions "avg" | "sum" | "max" | "min" | "count" as arguments.
Before v9.0
{
width: 130,
id: "balance",
header: [{text: "Balance"}, {content: "inputFilter"}],
footer: [
{
content: "sum",
tooltipTemplate: balanceTemplate
},
]
}
Since v9.0 it is possible both to define the default statistical functions and create custom functions for data calculation. The following new functionality has been added:
dhx.methods
that allows:From v9.0
const rows = [{ value: 10 }, { value: 20 }, { value: 30 }];
const sum = dhx.methods.sum(rows, "value");
From v9.0
dhx.methods.doubleSum = (rows, field) => {
return rows.reduce((sum, row) => sum + row[field] * 2, 0);
};
const grid = new dhx.Grid("grid_container", {
columns: [
{
id: "population",
header: [{ text: "Population" }],
footer: [{ text: (content) => content.doubleSum }],
summary: "doubleSum"
},
],
data: dataset
});
the summary
config options are added into Grid and column configuration for calculating values based on columns data while creating a summary list both at the Grid and column's levels
the getSummary()
method is added for getting the summary data either of a column or of the Grid
the text
property of the Grid column header/footer configuration object can be set as a callback function called with the following parameter:
content
- an object with the content of the column header/footer that contains the calculated values from the summary
property as key:value pairs, where:
the tooltipTemplate
property of the Grid column header/footer configuration object can be set as a callback function called with the following parameters:
content
- an object with the content of the header/footer. Contains two properties which are available either from the component's or from the column's configuration:
value
- (string) the value rendered in a cell, including the applied templatessummary
property, set as key:value pairs where:
header/footer
- (object) the object of the column header/footercolumn
- (object) the object of a columnthe text
property of the Grid spans configuration object can be set as a callback function called with the following parameter:
content
- an object with the content of the spans tooltip that contains the calculated values from the summary
property as key:value pairs, where:
the tooltipTemplate
property of the Grid spans configuration objects can be set as a callback function called with the following parameters:
content
- an object with the content of the spans tooltip. Contains two properties which are available either from the component's or from the column's configuration:
value
- (string) the value rendered in a cell, including the applied templatessummary
property, set as key:value pairs where:
span
- (object) the span objectFrom v9.0
const grid = new dhx.Grid("grid", {
columns: [
{ width: 200, id: "country", header: [{ text: "Country" }] },
{
width: 150,
id: "population",
header: [
{
text: "Population" ,
tooltipTemplate: ({ totalPopulation, count }) => `Total: ${totalPopulation}, Count: ${ count }`
}
],
summary: "count"
},
{
width: 150,
id: "age",
header: [{ text: "Med. Age" }],
summary: { avgAge: "avg" }
}
],
summary: {
totalPopulation: ["population", "sum"],
},
spans: [
{
row: "6",
column: "population",
rowspan: 9,
text: ({ count }) => ("Count population:" + count),
tooltipTemplate: ({ value, count }) => (`value: ${value}; count: ${count}`),
},
],
data: dataset
});
const totalSummary = grid.getSummary();
console.log(totalSummary);
const columnSummary = grid.getSummary("age");
console.log(columnSummary);
Date format in a columnâ
Before v9.0, the format for dates in a column has been set by specifying the type: "date"
property and the format
option:
Before v9.0
{
width: 150, id: "date", header: [{ text: "Date" }],
type: "date", format: "%M %d %Y"
}
Since v9.0, to set the format for dates, you need to use the combination of the type: "date"
property and the dateFormat
option:
From v9.0
{
width: 150, id: "date", header: [{ text: "Date" }],
type: "date", dateFormat: "%M %d %Y"
}
Data format in a columnâ
Before v9.0 the necessary format of data for a column has been specified via the format
property:
Before v9.0
{
width: 130,
id: "cost",
header: [{ text: "Cost" }, { content: "inputFilter" }],
template: (value) => `$${value}`,
format: "#.0",
}
Since v9.0, the data format is specified via the numberMask
configuration option of a column object:
From v9.0
{
width: 130,
id: "cost",
header: [{ text: "Cost" }, { content: "inputFilter" }],
footer: [{ content: "sum" }],
numberMask: {
prefix: "$", minDecLength: 0
}
}
Displaying the percentage value in a columnâ
Before v9.0, to display the percentage value in a column, the type: "percent"
configuration option has been used:
Before v9.0
{
width: 150, id: "yearlyChange", header: [{ text: "Yearly Change" }],
type: "percent"
}
Since v9.0, the percentage value is specified via the suffix: "%"
attribute of the numberMask
configuration option of a column object:
From v9.0
{
width: 120, id: "yearlyChange", header: [{ text: "Yearly Change" }],
numberMask: { suffix: "%" }
}
8.1 -> 8.2â DataCollection/TreeCollectionâ
Before v8.2, the smartFilter
property of the filter()
method defined whether a filtering rule will be applied after adding and editing items of the collection.
Since v8.2 this property is deprecated and replaced with the permanent
one. All active filters are stored in DataCollection/TreeCollection and will be automatically applied once again after calling the add/update/parse
methods.
Besides, the id
property has been added into the configuration object of the filter()
method.
Before v8.0, the getHeaderFilter()
method returned either an HTML element or an object with Combobox configuration. That allowed you to set focus on the filter or remove it:
const countryFilter = grid.getHeaderFilter("country");
countryFilter.focus();
countryFilter.blur();
const countryFilter = grid.getHeaderFilter("density");
countryFilter.focus();
In v8.0, we've improved the way of work with the filter. Now the getHeaderFilter()
method returns an object with a set of methods which allow you to get an object of the filter, to set/remove focus from the filter, to set a value by which a column will be filtered or to clear this value.
If you need to get an HTML object or an object with configuration of Combobox, apply the getFilter()
method of the header filter object:
const filter1 = grid.getHeaderFilter("country").getFilter();
console.log(filter1);
const filter2 = grid.getHeaderFilter("netChange").getFilter();
console.log(filter2);
Message boxâ
Before v8.0, the dhx.message()
constructor just added a new element to DOM.
Starting from v8.0, the constructor looks like dhx.message(): {close() => void};
. It will return an object with the method which allows calling a function to remove the element from DOM.
Before v8.0
const message = dhx.message({
text: "Message text",
icon: "dxi-clock",
css: "expire",
expire: 1000
});
console.log(message);
From v8.0
const message = dhx.message({
text: "Message text",
icon: "dxi-clock",
css: "expire",
expire: 1000
});
console.log(message);
7.1 -> 7.2â Comboboxâ
The open
event has been deprecated in v7.2. The new beforeOpen
and afterOpen
events have been added.
Before v7.2
combo.events.on("open", function(){
});
From v7.2
combo.events.on("beforeOpen", function() {
return false;
});
combo.events.on("afterOpen", function() {
});
Though the open
event remains backward compatible with previous versions, you'd better use the afterOpen
event instead.
dateFormat
configuration option of the column has been deprecated. Though the support of the option continues, we recommend that you use the format option together with type: "date"
instead.Before v7.1
{
width: 150, id: "start_date",
header: [{ text: "Calendar", colspan: 2 }, { text: "Start date" }],
type: "date", dateFormat: "%d/%m/%Y"
}
From v7.1
{
width: 150, id: "date", header: [{ text: "Date" }],
type: "date", format: "%M.%d.%Y"
}
sort
event has been deprecated in v7.1. Instead of it, you should use the afterSort
and beforeSort
events.Before v7.1
grid.events.on("Sort", function(id){
console.log("The grid is sorted by the "+id+" column");
});
From v7.1
grid.events.on("afterSort", (col, dir) => {
console.log(col, dir);
});
grid.events.on("beforeSort", (col, dir) => {
console.log("beforeSort", col, dir);
});
6.5 -> 7.0â Grid/TreeGridâ
splitAt
configuration property of Grid has been deprecated. The property is still available but not recommended for use.Starting from v7.0, use leftSplit instead.
Before v7.0
const grid = new dhx.Grid("grid_container", {
columns: [
],
splitAt: 2,
data: dataset
});
From v7.0
const grid = new dhx.Grid("grid_container", {
columns: [
],
leftSplit: 2,
data: dataset
});
Layoutâ
gravity
property of a Layout cell was intended to arrange content evenly throughout the cell.Starting from v7.0, the property is used for setting the "weight" of a cell in relation to other cells placed in the same row, within one parent.
The type of the property has been changed from boolean to number, but boolean type is still available for backward compatibility purposes.
DataView/ListâenableSelection()
, disableSelection()
. These methods are still available but not recommended for use.Instead of the methods, use new enable()
, disable()
methods of the selection object.
Before v7.0
dataview.enableSelection();
dataview.disableSelection();
list.enableSelection();
list.disableSelection();
From v7.0
dataview.selection.enable();
dataview.selection.disable();
list.selection.enable();
list.selection.disable();
Form and Form controlsâ
Starting with 7.0, to access the Form control you can use either the name of the control or its id (if the name attribute is not defined in the config of the control). In previous versions it was possible to access the control only by id.
The following events of Form have been deprecated: buttonClick
, validationFail
. These events are still available but not recommended for use.
Instead of the buttonClick
event, use the new click
event.
Before v7.0
form.events.on("buttonClick", function(id, events) {
console.log(id);
});
From v7.0
form.events.on("click", function(name, events) {
console.log("Click", name, events);
});
Instead of the validationFail
event, use the new afterValidate
, beforeValidate
events:
Before v7.0
form.events.on("validationFail", function(id,component){
});
From v7.0
form.events.on("afterValidate", function(name, value, isValid) {
console.log("AfterValidate", name, value, isValid);
});
form.events.on("beforeValidate", function(name, value) {
console.log("BeforeValidate", name, value);
return true;
});
value
property of the Button control of Form has been replaced by the text
one.The setValue()
method of the Button control of Form has been deprecated.
form.getItem("button_id").setValue("button_value");
The gravity
property have been deprecated for all Form controls.
The readonly
attribute of the Combo control of Form have been deprecated. Starting from v7.0, use readOnly
instead.
Also note, that before v7.0, the confirm buttons were displayed in the following order: "Apply" and "Reject". In the version 7.0, the order has been changed to "Reject" and "Apply".
TimePickerâapply
event of TimePicker has been deprecated. Instead of it, use the new beforeApply
and afterApply
events.Before v7.1
timepicker.events.on("apply", function(){
console.log("The value of a timepicker "+ timepicker.getValue() + " has been saved");
});
After v7.1
timepicker.events.on("beforeApply", function(value){
console.log("The ", value, " of a timepicker will be saved");
return false;
});
timepicker.events.on("afterApply", function(value){
console.log("The ", value, " of a timepicker is saved");
});
Comboboxâ
readonly
configuration property have been deprecated. Starting from v7.0, use readOnly
instead.const combo = new dhx.Combobox("combo_container", {
readOnly: true
});
6.3 -> 6.4â
calendar.events.on("dateHover", function(){})
calendar.events.on("dateMouseOver", function(){})
Properties block
disabledDates
view
mode
ColorPickerâ Up to version 6.3 From version 6.4 Methods colorpicker.focusValue()
colorpicker.setFocus()
Events colorpicker.events.on("viewChange",function(){})
colorpicker.events.on("modeChange", function(){})
colorpicker.events.on("selectClick",function(){})
colorpicker.events.on("apply", function(){})
Comboboxâ Up to version 6.3 From version 6.4 Events combo.events.on("close", function(){})
combo.events.on("afterClose", function(){})
Properties cellHeight
itemHeight
help
helpMessage
showItemsCount
itemsCount
DataViewâ Up to version 6.3 From version 6.4 Methods dataview.edit()
dataview.editItem()
Events dataview.events.on("contextMenu", function(){})
dataview.events.on("itemRightClick", function(){})
Properties editing
editable
The multiselectionMode
property is deprecated. Starting from the version 6.4 , it is possible to set the mode of selection of multiple items using the multiselection
property of DataView.
grid.edit()
grid.editCell()
Properties editing
editable
fitToContainer
autoWidth
headerSort
sortable
The columnsAutoWidth
property is replaced with the adjust
property. The property can take one of three values: "header", "data" or true.
Before 6.4 the adjustColumnWidth()
method took only one parameter - the id of the column. Starting from v6.4, it is also possible to pass the mode of adjusting a column ("header", "data", true) as a second parameter.
list.edit()
list.editItem()
Events list.events.on("contextMenu", function(){})
list.events.on("itemRightClick", function(){})
Properties editing
editable
The multiselectionMode
property is deprecated. Starting from the version 6.4 , it is possible to set the mode of selection of multiple items using the multiselection
property of List.
The toggle
event is deprecated. Use new beforeCollapse
, afterCollapse
, beforeExpand
, afterExpand
events instead.
help
helpMessage
thumbLabel
tooltip
Tabbarâ Up to version 6.3 From version 6.4 Methods tabbar.removeCell()
tabbar.removeTab()
tabbar.addCell()
tabbar.addTab()
Events tabbar.events.on("close", function(){})
tabbar.events.on("afterClose", function(){})
Properties closeButtons
closable
activeView
activeTab
TimePickerâ Up to version 6.3 From version 6.4 Events timepicker.events.on("close", function(){})
timepicker.events.on("afterClose", function(){})
timepicker.events.on("save", function(){})
timepicker.events.on("apply", function(){})
Properties action
controls
Treeâ Up to version 6.3 From version 6.4 Properties editing
editable
The isFolder
property is deprecated. Instead of it, you can set the icon
property in the configuration object of a tree item to add custom icons for tree items.
const tree = new dhx.Tree("tree_container", {
data:[
{
"value": "Books",
"id": "Books",
"opened": true,
"items": [
{
"value": "Lawrence Block",
"id": "Lawrence Block",
"icon": {
"folder": "fas fa-book",
"openFolder": "fas fa-book-open",
"file": "fas fa-file"
}
}
]
}
]
});
TreeGridâ Up to version 6.3 From version 6.4 Methods treegrid.edit()
treegrid.editCell()
Properties editing
editable
fitToContainer
autoWidth
headerSort
sortable
The columnsAutoWidth
property is replaced with the adjust
property. The property can take one of three values: "header", "data" or true.
Before 6.4 the adjustColumnWidth()
method took only one parameter - the id of the column. Starting from v6.4, it is also possible to pass the mode of adjusting a column ("header", "data", true) as a second parameter.
The labelInline
property is replaced with the labelPosition
property. The labelPosition
property defines the position of a label.
editing
editable
help
helpMessage
celCss
css
Combo controlâ Up to version 6.3 From version 6.4 cellHeight
itemHeight
DatePicker controlâ Up to version 6.3 From version 6.4 block
disabledDates
view
mode
Slider controlâ Up to version 6.3 From version 6.4 thumbLabel
tooltip
TimePicker controlâ Up to version 6.3 From version 6.4 action
controls
6.2 -> 6.3â
getView()
getCurrentMode()
colorpicker.events.on("colorChange",function(){})
colorpicker.events.on("change", function(){})
Gridâ Up to version 6.2 From version 6.3 grid.events.on("headerInput", function(){})
grid.events.on("filterChange", function(){})
Layoutâ Up to version 6.2 From version 6.3 layout.cell(id)
layout.getCell(id)
Treeâ Up to version 6.2 From version 6.3 tree.close(id)
tree.collapse(id)
tree.closeAll()
tree.collapseAll()
tree.open(id)
tree.expand(id)
tree.openAll()
tree.expandAll()
tree.unCheckItem(id)
tree.uncheckItem(id)
tree.events.on("itemContextMenu", function(){})
tree.events.on("itemRightClick", function(){})
TreeGridâ Up to version 6.2 From version 6.3 grid.events.on("headerInput", function(){})
grid.events.on("filterChange", function(){})
Windowâ Up to version 6.2 From version 6.3 window.fullScreen()
window.setFullScreen()
Instead, use the corresponding getFocus()
method for getting the id of an item in focus:
list.getFocus();
dataview.getFocus();
and the setFocus() method for setting focus to an item by its id:
list.setFocus("item_id");
dataview.setFocus("item_id");
In case you still need to get the index of an item in focus, make use of the code, as in:
const id = list.getFocus();
const index = list.data.getIndex(id);
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4