Author Topic: Stop last column from auto expanding to fit table?  (Read 4307 times)

Eagle_f90

  • Newbie
  • *
  • Posts: 15
    • View Profile
Stop last column from auto expanding to fit table?
« on: January 29, 2016, 07:55:12 pm »
I have a specified width set for all my columns but one. The hope was that the one column with no set width would auto expand/shrink depending on the size of the table, unfortunately it is not. No matter what I seem to do the final column, which has a set width, will always expand/shrink to fill the table instead of column 10 (the column with no set width). How do I make it so column 10 expands/shrinks and not the last column?

Code: [Select]
            var colModel = [
                { title: "Project ID", dataType: "integer", dataIndx: "ID", hidden: true },
                { title: "Project Name", dataType: "string", dataIndx: "Name", resizable: true, width: 200, halign: "center" },
                { title: "Notes", dataType: "string", resizable: false, width: 75, halign: "center" },
                { title: "Change Type", dataType: "string", dataIndx: "Type", resizable: true, width: 169, halign: "center" },
                { title: "Priority", dataType: "string", dataIndx: "Priority", resizable: true, width: 55, halign: "center" },
                { title: "Impact", dataType: "string", dataIndx: "Impact", resizable: true, width: 55, halign: "center" },
                { title: "Assigned To", dataType: "string", dataIndx: "AssignedTo", resizable: true, width: 150, halign: "center" },
                { title: "Estimated Start Date", dataType: "date", dataIndx: "EstimatedStartDate", resizable: true, width: 150, halign: "center" },
                { title: "Estimated Completion Date", dataType: "date", dataIndx: "EstimatedEndDate", resizable: true, width: 175, halign: "center" },
                { title: "Date Actually Started", dateType: "date", dataIndx: "DateStarted", resizable: true, width: 150, halign: "center" },
                { title: "Date Actually Compleated", dataType: "date", dataIndx: "DateCompleated", resizable: true, width: 175, halign: "center" },
                { title: "Reason For Change", dataType: "string", dataIndx: "Reason", resizable: true, halign: "center" },
                { title: "Approval Status", dataType: "string", dataIndx: "ApprovalStatus", resizable: true, width: 105, halign: "center" },
                { title: "Approved By", dataType: "string", dataIndx: "ApprovedBy", resizable: true, width: 150, halign: "center" }
            ];

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Stop last column from auto expanding to fit table?
« Reply #1 on: January 29, 2016, 08:12:57 pm »
only the last column can be controlled.

scrollModel.lastColumn = "auto", "fullScroll" and "none".

http://paramquery.com/api#option-scrollModel

Eagle_f90

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Stop last column from auto expanding to fit table?
« Reply #2 on: January 29, 2016, 08:41:33 pm »
Is there anyway of dynamically sizing the rows at all or does everything have to be a fixed width?
« Last Edit: January 29, 2016, 08:45:09 pm by Eagle_f90 »

Eagle_f90

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: Stop last column from auto expanding to fit table?
« Reply #3 on: January 29, 2016, 09:13:52 pm »
Trying to do this based off of http://paramquery.com/api#option-column-width I came up with this code but it does not resize the column but the grid does get resized correctly

Code: [Select]
            $(window).resize(function (evt)
            {
                var GridWidth = $Grid(window).width() - 10;
                var ColumnModel = $Grid.pqGrid("option", "colModel");
                //colModel[11].Width = GridWidth - 1459;
                colModel[11].Width = 200;
                $Grid.pqGrid("option", { width: GridWidth });
                $Grid.pqGrid("option", "colModel", ColumnModel);
            });