Author Topic: Exceptions using flex function  (Read 1998 times)

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Exceptions using flex function
« on: September 02, 2020, 01:42:58 am »
I have the following code which builds an array of columns to apply flex to.  I tried using both ColIndx as well as dataIndx with the same result.

Code: [Select]
  var flexCols = new Array();
  $.each(columns, function (i, col)
  {
    if (col.doFlex)
      flexCols.push(i); // (col.dataIndx);
  });
  if (flexCols.length > 0)
  {
    _pqSearchGrid.flex({ colIndx: flexCols }); // ({dataIndx: flexCols})
  }

What I am finding is that the paramQuery code eventually gets down to the following function and passes the array (colIndx or dataIndx) as both parameters to this function:

Code: [Select]
        setColWdArr: function(initH, finalH) {
            var ci = finalH,
                rip, self = this,
                offset = self.riOffset,
                jump = self.jump,
                CM = self.colModel,
                column, cell, rd, data = self.data,
                width, fr = self.freezeRows,
                maxWidth = self.maxHt + "px",
                wd, consider, iM = self.iMerge,
                m, initV = self.initV,
                child, child2, isBody = self.isBody(),
                isSum = self.isSum(),
                takeColumnWidths = isBody || isSum,
                finalV = self.isHead() ? self.that.headerCells.length - 1 : self.finalV;
            if (finalV >= 0) {
                for (; ci >= initH; ci--) {
                    column = CM[ci];
                    if (!column.hidden && (column.width + "").indexOf("%") == -1) {
                        wd = takeColumnWidths ? column.width : column._minWidth;
                        if (wd) {

The issue comes in at the line "column = CM[ci];".  This is using an array as the indexer into the column model array.  The result is column is undefined and the next statement generates the exception.

I verified that the data passed into the flex method was valid.  In my case it was just an array with a single entry.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: Exceptions using flex function
« Reply #1 on: September 02, 2020, 03:36:04 pm »
Thanks for reporting issue. I'm looking into it.

ralph1996

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 80
    • View Profile
Re: Exceptions using flex function
« Reply #2 on: September 02, 2020, 09:32:53 pm »
FYI:

As a workaround I find that if I just pass the column index to the flex function it will work for a single column (e.g. pqgrid.flex(12)).  So I am now looping through the flex columns and calling flex for each column that we want flex applied.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: Exceptions using flex function
« Reply #3 on: September 16, 2020, 03:57:00 pm »
This has been fixed in v7.4