jQuery UI Widgets Forums Grid Autosize columns in grid

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 10 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Autosize columns in grid #48486

    rani
    Participant

    Hello,

    i need to put the
    Autosize all columns so that the full text is shown by default.
    I have set to width:’auto’
    but it is not working .
    my code is
    $(“#IngestGrid”).jqxGrid(
    {
    //width: ‘99%’,
    width:1200,
    source: source,
    // pageable: true,
    height: 550,
    theme: ‘arctic’,
    sortable: true,
    altrows: true,
    enabletooltips: true,
    columnsresize: true,
    columnsreorder: true,
    editmode: ‘programmatic’,
    localization: getLocalization(),
    selectionmode: ‘singlecell’,
    //selectionmode: ‘multiplecellsadvanced’,
    editable: true,
    columns: [

    {
    text: ”, datafield: ‘IsChecked’, columntype: ‘checkbox’, checked: true, editable: true, pinned: true, width: ‘2%’, sortable: false, cellsrenderer: cellsrenderer, rendered: function () {
    $(‘#IngestGrid’).on(‘rowunselect’, gridrowunselect);
    }
    },
    { text: ‘Filename’, datafield: ‘FileName’, width: ‘auto’, editable: false, pinned: true },
    { text: ‘Size’, datafield: ‘Size’, width: ‘auto’, editable: false, pinned: true, sortable: false },
    { text: ‘Ext.’, datafield: ‘Extension’, width: ‘auto’, editable: false, pinned: true, sortable: false },
    { text: ‘Type’, datafield: ‘AssetType’, width: ‘auto’, editable: false, sortable: false },
    { text: ‘Customer’, datafield: ‘Customer’, width: ‘auto’, id: ‘ddl’, columntype: ‘combobox’, createeditor: CreateEditorForCustomer, initeditor: initeditorforCustomer, cellvaluechanging: Customer_cellvaluechanging, sortable: false },
    { text: ‘Title’, datafield: ‘Title’, id: ‘ddlFS’, columntype: ‘combobox’, width: ‘auto’, sortable: false, createeditor: CreateEditorForFSTitle, initeditor: initeditorForFSTitle, cellvaluechanging: FeatureSeriesTitle_cellvaluechanging },
    { text: ‘Ep.Title’, datafield: ‘EpisodeTitle’, width: ‘auto’, columntype: ‘combobox’, sortable: false, createeditor: CreateEditorForEPTitle, initeditor: initeditorForEPTitle, cellvaluechanging: EpisodeTitle_cellvaluechanging },
    { text: ‘Ep.#’, datafield: ‘EpisodeNumber’, width: ‘auto’, sortable: false },
    {
    text: ‘Language’, datafield: ‘Language’, width: ‘auto’, id: ‘cmbLanguage’, columntype: ‘combobox’, createeditor: Language_createeditor, cellvaluechanging: Language_cellvaluechanging, sortable: false

    },
    ]

    what’s wrong in my code

    regards,
    rani

    Autosize columns in grid #48489

    Dimitar
    Participant

    Hello rani,

    The columns of the grid do not support width: "auto".

    To achieve this, please call the autoresizecolumns method in the ready callback function, i.e.:

    $(“#IngestGrid”).jqxGrid(
    {
    //width: ’99%’,
    width:1200,
    source: source,
    // pageable: true,
    height: 550,
    theme: ‘arctic’,
    sortable: true,
    altrows: true,
    enabletooltips: true,
    columnsresize: true,
    columnsreorder: true,
    editmode: ‘programmatic’,
    localization: getLocalization(),
    selectionmode: ‘singlecell’,
    //selectionmode: ‘multiplecellsadvanced’,
    editable: true,
    ready: function () {
        $('#IngestGrid').jqxGrid('autoresizecolumns');
    },
    columns: [
    ...

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.