How to set the width of a Wijgrid?

932 Views Asked by At

Code to construct the wijgrid:

// Construct the grid
    $("#wijgridObject").wijgrid({
        allowPaging: true,
        allowSorting: true,       
        pageSize: gridTotalRows,
        pagerSettings: { position: "bottom" },
        allowColMoving: false,
        columnResizing: false,
        allowColSizing: false,
        data: currentLayer.GridObjects,
        showFilter: true,
        rowStyleFormatter: function (args) 
        {
            ...
        },
        columns: gridColumnGroupings
    });

How can i set the width of the Wijmo grid? Mine seems to not be auto filling with the width of the browser window....

The wijmo people are usless and there are no other topics about setting the width of a wijgrid to be like 100%

2

There are 2 best solutions below

0
On BEST ANSWER
$("#wijgridObject").wijgrid("option", "pageSize", calculateGridHeight());

or

$("#wijgridObject").wijgrid("option", "pageSize", 256);
0
On

to get the dimmensions of the parent elment

var width = $("#parentElement").get(0).offsetWidth; var height = $("#parentElement").get(0).offsetHeight;

$( "table" ).wijgrid( "setSize", width , heigth );

if you want any of the dimensions to be set automatically use "auto" for width or height.