Вопрос

According to the API documentation of JQWidgets, Width of grid columns can be set in pixel value by "setcolumnproperty" method. Like below

$('#jqxGrid').jqxGrid('setcolumnproperty', 'firstname', 'width', 100);

But I need it in percentage. Can anyone help me?

Это было полезно?

Решение 2

There is no direct solution as the method "setcolumnproperty" does not support widths as percentages. However, the column properties, such as "width", can be set in percentage when creating the grid as below.

$("#jqxgrid").jqxGrid(
{
    source: dataAdapter,
    columns: [
        { text: 'First Name', datafield: 'firstname', width: '20%'  },
        { text: 'Last Name', datafield: 'lastname', width: '20%' },
        { text: 'Product', datafield: 'productname', width: '20%' }
    ]
});

Again the column properties can be passed by an array after setting those properties as required.

Другие советы

instead of 100, you can pass something like "30%"

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top