0

i use kendo react in my project. in datagrid component , table that has 'k-grid-table' class width is 0 ! where is the problem ?

as below

1 Answers1

1

The width is calculated by the sum of all column widths in pixels only if every of them have a width. So you either have zero columns, or all of them have 0 width.

Here is the actual code:

    Grid.prototype.resetTableWidth = function () {
    var totalWidth = 0;
    if (!this.columnResize.colGroupMain) {
        return;
    }
    var colElements = this.columnResize.colGroupMain.children;
    for (var i = 0; i < colElements.length; i++) {
        var width = colElements[i].width;
        if (!width) {
            return;
        }
        totalWidth += parseFloat(width.toString());
    }
    totalWidth = Math.round(totalWidth);
    if (this._header) {
        this._header.setWidth(totalWidth);
    }
    if (this.vs.table) {
        this.vs.table.style.width = totalWidth + 'px';
    }
};

From https://unpkg.com/@progress/kendo-react-grid@1.2.0-dev.201807111121/dist/es/Grid.js (The current latest dev version)

Xizario
  • 481
  • 2
  • 9