Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - pbassey

Pages: [1] 2 3 4
1
Thank you.  I implemented the style setting just below the pggrid .css styles (inside the <body> tag as well as in the <head> section), but neither  appear to affect the font size of the grid. 

Are there any other settings that might override this?
Below is my pggrid settings:

    function exportXlsx() {
        var $t = this.toolbar(),
            hlAlternateRows = $t.find('.alternateRows').prop('checked');

        var blob = this.exportData({
            format: 'xlsx',
            eachRow: function (row, ri, rowData, rows) {
                if (hlAlternateRows && rows.length % 2 != 0) {
                    row.bgColor = "#f0f0f0";
                }
            },
            linkStyle: "text-decoration:underline;color:#0d6efd;",
            skipHiddenCols: $t.find('.xHCols').prop('checked'),
            skipHiddenRows: $t.find('.xHRows').prop('checked'),
            selection: $t.find('.selectedRows').prop('checked') ? 'row' : '',
            render: $t.find('.render').prop('checked')
        });
        pq.saveAs(blob, "USIndustrySummaryData.xlsx");
    }
   function groupChg(val){
      var lower = Math.floor( val/ 10 ) * 10,
          upper = Math.ceil( (val + 1)/ 10 ) * 10;
      return lower + " < " + upper;
   };

   var obj = {
      height: 340,
      width: '100%',
      title: 'CCI/CI Summary',
      showTitle: false,
      numberCell: {show: false},
      rowBorders: true,
      dataModel: {
         location: "remote", //server side call
         dataType: "jsonp",
         method: "GET",
            url: "/IND/Account/grid_summary?YearVal=" + theYear, //URL
         getData: function (dataJSON) {
            var data = dataJSON.data;
            return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
         }
      },
        colModel: [
            { dataIndx: 'grp', title: 'Source', tpHide: true, menuInHide: true, minWidth: 150 },
            { dataIndx: "Source", title: "Cost/Expense Items", hidden: true, filter: { groupIndx: 'CCIAccountDesc' } },
            { dataIndx: "CCIAccountDesc", title: "Cost/Expense Items", minWidth: 450 },
            { dataIndx: "Actual_YTD", title: 'ACTUAL YTD', valign: "top", format: '$ #,###,###.00', summary: { type: "sum" }, valign: "top", align: "right", minWidth: 130 },
            { dataIndx: "Projections", title: 'PROJECTIONS', valign: "top", format: '$ #,###,###.00', summary: { type: "sum" }, valign: "top", align: "right", minWidth: 140 },
            { dataIndx: "Proj_Total", title: 'PROJ TOTAL', valign: "top", format: '$ #,###,###.00', summary: { type: "sum" }, valign: "top", align: "right", minWidth: 130 },
            { dataIndx: "Budget", title: 'BUDGET', valign: "top", format: '$ #,###,###.00', summary: { type: "sum" }, valign: "top", align: "right", minWidth: 130 },
            { dataIndx: "Variance", title: 'VARIANCE', valign: "top", format: '$ #,###,###.00', summary: { type: "sum" }, valign: "top", align: "right", minWidth: 130 },
            { dataIndx: "Notes", title: 'NOTES', valign: "top", minWidth: 250 }

        ],
        groupModel: {
            on: true,                                  //grouping mode.
            pivot: false,                               //pivotMode
            checkbox: false,
            checkboxHead: false,
            select: true,
            titleIndx: 'grp',                            //v7.0.0: new option instead of titleInFirstCol
            indent: 20,
            fixCols: false,
            groupCols: ['CCIAccountDesc'],                   //grouping along column axis.
            header: false,                               //hide grouping toolbar.
            grandSummary: true,                         //show grand summary row.
            dataIndx: ['Source'],                         //grouping along row axis.
            collapsed: [true],
            useLabel: true,
            summaryEdit: false
      },
      summaryTitle: {sum: "" },
        pageModel: {
            type: "remote", //Paging remote
            rPP: 100, strRpp: "{0}", //default paging parameters
        },
      wrap: false,
      hwrap:false,
      editable: false,

      toolbar: {
          cls: 'pq-toolbar-export',
          items: [
                {
                    type: 'button',
                    label: "Export to Excel(xlxs)&nbsp;",
                    icon: 'ui-icon-arrowthickstop-1-s',
                    listener: exportXlsx
                },
              {
                  type: 'textbox',
                  label: "Filter: ",
                  attr:'placeholder="Enter text"',
                  listener:{timeout: function (evt) {
                      var txt = $(evt.target).val();
                      var rules = this.getCMPrimary().map(function(col){
                          return {
                              dataIndx: col.dataIndx,
                              condition:'contain',
                              value: txt
                          }
                      })
                      this.filter({
                          mode: 'OR',
                          rules:rules
                      })
                  }}
              }
          ]
      },
      toolPanel:{
          show: false  //show toolPanel initially.
      },

      //use pivotCM event to make grouped columns collapsible.
      pivotCM: function(evt, ui) {
          //add collapsible to grouped parent columns.
          this.Columns().each(function(col){
              var cm = col.colModel
              if(cm && cm.length>1 && !col.collapsible)
                  col.collapsible = {on: true, last: true};
          }, ui.CM);
      }
   };
   var grid1 = pq.grid( "#Summary", obj);
   grid1.option( "selectionModel", {type: 'row', mode: 'single'} );

2
Can you tell me what the command is in ParamQuery to set the entire grid to the following:
.pq-grid {
  font-family: 'Arial', sans-serif;
  font-size: 14px;
}

I placed the above style setting just about the javascript and it did not have any effect on the font size of the text in the grid.

Thanks...

3
just to clarify, the error is occurring when I click on the rendered link, not when the grid is rendered...

4
I have the following column model definition:       

colModel: [
            { dataIndx: 'KeyRec', title: 'KeyRec', hidden: true, editable: false },
            { dataIndx: 'ActivityYear', title: 'ActivityYear', hidden: true, editable: false },

            { dataIndx: 'grp', title: 'ActivityId', tpHide: true, editable: false, menuInHide: true, minWidth: 150 },
            { dataIndx: "ActivityId", title: "FAS Activity", editable: false, hidden: true, filter: { groupIndx: 'Region' } },
            { dataIndx: "Project", title: 'Project Code', valign: "top", editable: false, valign: "top", minWidth: 110 },
            { dataIndx: "Source", title: 'Source', valign: "top", editable: false, valign: "top", minWidth: 70 },
            { dataIndx: "ProjBud", title: 'Project Budget', valign: "top", format: '$ #,###,###.00', editable: false, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 100 },

            {
                dataIndx: "YTD_Tot", title: 'YTD Through<br>@lastMonthName', halign: "center", valign: "top", format: '$ #,###,###.00',
                editable: false, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 100,
                //render: function (ui) {
                //    var ActivityID = ui.rowData.ActivityId;
                //    return "<a href='#' onClick=javascript:OpenTranWindow(" + "'" + ActivityID + "'" + ");>" + ui.cellData + "</a>";
                //}
            },
            {
                title: "Projection Months", align: "center", collapsible: { last: true, on: false },
                colModel: [

               @foreach (var month in months)
               {
                  @: { dataIndx: "@month.DataIndx", title: '@month.Title', editor: { type: 'textbox', attr: 'maxlength="12"' }, valign: "top", format: '$ #,###,###.00', editable: true, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 90 },
               }

                    { dataIndx: "RegTotal", title: 'Total<br>Projections', halign: "center", valign: "top", format: '$ #,###,###.00', editable: false, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 100 },
                ]
            },
            { dataIndx: "RegBudget", title: 'Total<br>Projections<br>Spent', halign: "center", valign: "top", format: '$ #,###,###.00', editable: false, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 90 },
            { dataIndx: "curMonAct", title: 'February<br>Actual', halign: "center", valign: "top", format: '$ #,###,###.00', editable: false, summary: { type: "sum" }, valign: "top", align: "right", minWidth: 90 },
        ],

When I remove the comments on the YTD_Tot col and click on the link, I get the message:
Uncaught use Group().option() method to set groupModel options.

Can you tell me how the "Render" function could be coded?

5
Help for ParamQuery Pro / Re: Increase the size of the "Loading" box
« on: February 12, 2025, 11:14:19 pm »
Perfect, thank you!

6
Help for ParamQuery Pro / Increase the size of the "Loading" box
« on: February 12, 2025, 07:33:46 pm »
I am using the grid.showLoading control to display a message to the user while a post process is running.  Is there any way to increase the size of the box?  The text does not seem to be limited, but the size of the box displaying that text does...

   function callApiMethod() {
        grid.option("strLoading", "This may take up to 30 seconds. Please Stand by...");
        grid.showLoading();
      $.post("/IND/Account/LoadINDData", { "theYear": theYear }, function (data) {
         var f = JSON.parse(data)
         grid.hideLoading();
         grid.refreshDataAndView();
      });
   }

7
Help for ParamQuery Pro / Re: Example of how to save changes to cell data
« on: February 10, 2025, 09:27:30 pm »
I am not getting to the my debugger statement (see attachment) when I edit a cell in. my grid.  Can you tell me if there are any specific grid properties to look for that might be causing this?

8
Help for ParamQuery Pro / Example of how to save changes to cell data
« on: February 10, 2025, 01:47:37 am »
Can you please direct me to a code example that supports the updating (of a SQL database) of cell data changes in real time using .NET MVC?

9
Help for ParamQuery Pro / Excluding row data in Group Totals
« on: February 01, 2025, 01:29:58 am »
Is there a way to exclude certain rows (based on a column value) in the Group total calculation?

For example - I have a grid result that has budget (in yellow) and transaction data (in black).  I do not want the budget amounts in the Group total calculation (see attached screen shot).

Below is my javascript code:

dataModelTransaction=  {
location: "remote",
dataType: "jsonp",
method: "GET",
url: "/CCRSearch/Reports/GetTransactionsJson?ActivityId=@ViewBag.ActivityId",
}
colModelTransaction = [
    { dataIndx: 'grp', title: 'FASActivity', tpHide: true, editable: false, menuInHide: true, minWidth: 150 },
    { dataIndx: "FASActivity", title: "FAS Activity", editable: false, hidden: true, filter: { groupIndx: 'Source' } },   
    { title: "TRAN_TYPE", hidden: true, dataIndx: "TRAN_TYPE" },
    { title: "Source", width: 20, dataIndx: "Source" },
    { title: "Account Code", width: 20, dataIndx: "ACCNT_CODE" },
    { title: "Date", align: "right", width: 20, dataIndx: "JCDATE" },
    { title: "Description", width: 200, dataIndx: "FASDesc" },
    {
        title: "Amount", width: 85, format: '$ #,###,###.00', align: "right", dataIndx: "AMOUNT", summary: { type: "sum" },
        render: function (ui) {
            if (ui.cellData < 0) {
                return {
                    cls: 'blinkText',
                    style: { 'color': 'red'}
                };
            }
        }
    }
]
groupModel = {
    on: true,                             //grouping mode.
    pivot: false,                         //pivotMode
    checkbox: false,
    checkboxHead: true,
    select: false,
    titleIndx: 'grp',                      //v7.0.0: new option instead of titleInFirstCol
    indent: 20,
    fixCols: false,
    groupCols: ['Source'],                   //grouping along column axis.
    header: false,                         //hide grouping toolbar.
    grandSummary: true,                   //show grand summary row.     
    dataIndx: ['FASActivity'],                //grouping along row axis.
    collapsed: [true],
    useLabel: true,
    summaryEdit: false
};
           $("#Transactiondetails").html(data);
           $("#grid_transactions").pqGrid({
               height: 450,
               scrollModel: { autoFit: true },
               dataModel: dataModelTransaction,
               colModel: colModelTransaction,
               pageModel: { type: "local", rPP: 1000, strRpp: "" },
               numberCell: { show: false },
               title: "Transaction Details",
               resizable: true,
               groupModel: groupModel,
               summaryTitle: {
                   sum: ""
               }, 
               rowInit: function (ui) {
                   if (ui.rowData.TRAN_TYPE == "B") {
                       return {
                           style: { "background": "yellow" } //can also return attr (for attributes) and cls (for css classes) properties.
                       };
                   }
               }
           });


10
Help for ParamQuery Pro / Setting a Grid Row Color
« on: January 30, 2025, 02:19:32 am »
I have the following popup Grid logic below:

    dataModelTransaction=  {
    location: "remote",
    dataType: "jsonp",
    method: "GET",
    url: "/CCRSearch/Reports/GetTransactionsJson?ActivityId=@ViewBag.ActivityId",
    }
    colModelTransaction = [
        { title: "FAS Activity", width: 120, dataIndx: "FASActivity" },
        { title: "TRAN_TYPE", hidden: true, width: 100, dataIndx: "TRAN_TYPE" },
        { title: "Source", width: 40, dataIndx: "Source" },
        { title: "Account Code", width: 40, dataIndx: "ACCNT_CODE" },
        { title: "Date", width: 40, dataIndx: "JCDATE" },
        { title: "Description", width: 150, dataIndx: "FASDesc" },
                  {
            title: "Amount", width: 85, align: "right", dataIndx: "AMOUNT",
            cellClass: function (ui) {
                return ui.cellData < 0 ? "red-cell" : "";
            }
        }

    ]

    function OpenTranWindow(Activity) {
        $.post("/CCRSearch/Reports/GetTransactions?=", { "ActivityId": Activity}, function (data) {
            $("#Transactiondetails").html(data);
            $("#grid_transactions").pqGrid({
                height: 450,
                scrollModel: { autoFit: true },
                dataModel: dataModelTransaction,
                colModel: colModelTransaction,
                pageModel: { type: "local", rPP: 1000, strRpp: "" },
                numberCell: { show: false },
                title: "Transaction Details",
                resizable: true,
                 rowClass: function (ui) {
                    if (ui.rowData.TRAN_TYPE == "B") {
                        return "red-row";                                    // Apply a custom CSS class
                    }
                }

            });
            modal1.show();
        });
    }

I also have this style section in the html code above the javascript code:
<style>
    .red-row {
        background-color: red !important;
        color: white !important;
    }
    .red-cell {
        background-color: red !important;
        color: white !important;
    }
</style>
I am trying to set the entire row Red, if the hidden column, TRAN_TYPE = "B".  I am also trying to set the Amount column to Red if it is a negative value.

Can you tell me what I am doing wrong?


11
Can you tell me how to set all rows that contain a checkbox column to checked?

I am using the following column where the "checked" attribute is set to true, but no rows are being checked:

        colModel = [
            {
                title: "FAS Activity", dataType: "string", dataIndx: "FASActivity", editable: false, align: "left", minWidth: '20%',
                render: function (ui) {
                    return "<a href='#' onClick=javascript:OpenTranWindow(" + "'" + ui.cellData + "'" + ");>" + ui.cellData + "</a>";
                }
            },
            { title: "Region", dataType: "String", dataIndx: "RegionDesc", editable: false, minWidth: '40%', },
            {
                title: "Include ?", dataIndx: "Activity", type: 'checkbox', editable: false,
                cbId: 'chk', hidden: false, checked: true, useLabel: false, minWidth: '20%'
            },
            {
                dataIndx: 'chk',
                dataType: 'bool',
                cb: { header: true },
                hidden: true,
                editable: function (ui) {
                    //to make checkboxes editable selectively.
                    return !(ui.rowData.Activity.length > 10);
                }
            }
        ];

12
Your response worked great, Thank you!

I have 2 followup questions -

1. How to I make this button toggle the checkbox on/off.  Right now, it only checks the boxes based on the page filter.

2. I have this javascript function (below) that currently passes a list of rows that remain in the grid (based on grid filtering).  How do I get the list of grid rows that are only checked?

    $("#btnSubmit").click(function () {
        var pFASIDs = "";
        var grid = $("#grid_jsonp").pqGrid("instance");
        var selectedRows = grid.pageData().filter(function (row) {
            return row.FASActivity.length > 1;
        });
        // Extract the IDs of selected rows
        var selectedIDs = selectedRows.map(function (row) {
            return row.FASActivity;
        });
        pFASIDs = selectedIDs.join(","); ;

        window.location.href = '/CCRSearch/Reports/Index?LayoutId=180&IDs=' + pFASIDs;

    });

13
I am using the following code:

       var grid = $("#grid_jsonp").pqGrid("instance");       
       var matchingRows = grid.pageData().filter(function (row) {
            return row.FASActivity.startsWith("F");
        });

        // Get the row indices of the filtered rows
        var matchingIndices = matchingRows.map(function (row) {
            return grid.getRowIndx({ rowData: row }).rowIndx;
        });
       
        // Use the checkNodes API to check the matching rows
        grid.Checkbox("selected").checkNodes(matchingIndices);

Everything is working correctly expect the last line where the checkNodes function is called.

I am getting the following error message:
Uncaught TypeError: Cannot read properties of undefined (reading 'checkNodes')

I am using v9.x.  Could that be the issue?

14
My subscription expired and I would like to signup for pro support.  What is the link and the cost?

15
I have found the example to check/uncheck the entire column, but I am looking for a way to use a button(s) to check a checkbox cell when the checkbox value starts with a letter or set of letters (e.g. Starts with A, Starts with A45, etc).  Are there any examples of buttons doing this?  Below is the code I gave right now for the grid:

    var colModel = [
        {
            title: "Activity",
            minWidth: '30%',
            dataIndx: "FASActivity",
            type: 'checkbox',
            cbId: 'chk',
            hidden: false,
            useLabel: false
        },
        {
            dataIndx: 'chk',
            dataType: 'bool',
            cb: { header: true },
            hidden: true,
            editable: function (ui) {
                //to make checkboxes editable selectively.
                return !(ui.rowData.Activity.length > 10);
            }
        },
        { title: "Description", dataType: "String", dataIndx: "FASDesc", editable: false, minWidth: '30%', },
        { title: "Region", dataType: "String", dataIndx: "Region", editable: false, minWidth: '10%', },
        { title: "Country", dataType: "string", dataIndx: "Country", editable: false, minWidth: '10%', },
        { title: "Year", dataType: "String", dataIndx: "YearSplit", editable: false, minWidth: '10%', }
    ];
    //Define Data Mode;
    var dataModel = {
        location: "remote", //server side call
        dataType: "jsonp",
        method: "GET",
        url: "/CCRSearch/FAS/grid_jsonp", //URL
        getData: function (dataJSON, yearval) {
            var data = dataJSON.data;
            return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: data };
        }
    };
    var pageModel = {
        type: "remote", //Paging remote
        rPP: 500, strRpp: "{0}", //default paging parameters
    }

    var grid = $("#grid_jsonp").pqGrid({
        height: 550,
        scrollModel: { autoFit: true },
        dataModel: dataModel,
        colModel: colModel,
        auroRow: false,
        numberCell: { show: false },
        resizable: true,
        filterModel: {
            on: true,
            header: false,
            type: 'remote',
            menuIcon: false,
            mode: "AND"
        },
        pageModel: pageModel,
        toolbar: {
            style: 'text-align:center;',
            items: [

                {
                    type: 'button',
                    label: 'ATP',
                    listener: function () {
                        // check all Activities that start with 'A19'
                        EntityFilter('ATP');
                    }
                },
                { type: 'separator' },
                {
                    type: 'button',
                    label: 'FMD',
                    listener: function () {
                        // check all Activities that start with 'F'
                        EntityFilter('FMD');
                    }
                },
                { type: 'separator' },
                {
                    type: 'button',
                    label: 'MAP',
                    // check all Activities that start with 'M'
                    listener: function () {
                        EntityFilter('MAP');
                    }
                },
                { type: 'separator' },
                {
                    type: 'button',
                    label: 'RAPP',
                    // check all Activities that start with 'A24'
                    listener: function () {
                        EntityFilter('RAPP');
                    }
                },
                { type: 'separator' },
                {
                    type: 'button',
                    label: 'RAPP2',
                    // check all Activities that start with 'A25'
                    listener: function () {
                        EntityFilter('RAPP2');
                    }
                }
            ]
        },

        wrap: true, hwrap: true,
        virtualX: true, virtualY: true,
        complete: function (event, ui) {

            var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))

            var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
                return new bootstrap.Tooltip(tooltipTriggerEl)
            })
        }
    });

Pages: [1] 2 3 4