Author Topic: Group Model static field  (Read 2557 times)

joelclark

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
Group Model static field
« on: March 12, 2019, 02:56:23 am »
Hi There,

If you look at the photo I have attached and scroll all the way to the right you will notice I have a group model but I have this notes Icon that is a shortcut to open up a modal window. I only want this to appear on top at the group level but not appear with the records when you expand the group model. I tried looking everyone on the website for a way to do this and could not find one. The code for this is below:


My group model and part of my column model are as follows:
            {
                title: GS.res.rail.LeaseCarEntry_ReportingRr_Label, dataType: 'string', dataIndx: 'RoadHandled',
            },
            {
                title: GS.res.rail.LeaseCarEntry_Consignee_Label, dataType: 'string', dataIndx: 'Consignee',
            },
            {
                title: GS.res.rail.LeaseCar_Lease_Flag_Label, dataType: 'string', dataIndx: 'LeasedFlag', maxWidth: 50
            },
            {
                title: "", editable: false, sortable: false, dataType: "string", exportRender: false, resizable: true, minWidth: 40, maxWidth: 30, nodrag: true, render: function (ui) {
                   
                        return "<a  class='vc-view-notes' vc-car-name='" + ui.rowData.Railcar + "'><span title='" + GS.res.rail.RailTrace_AllNote_Label + "' class=\"far fa-sticky-note awesomefont\" aria-hidden=\"true\"></span></a>";
                }
            },
        ],

         groupModel: {
             on: true, // grouping mode //
             dataIndx: ["Railcar"], // row groupring
             collapsed: [true],
             dir: ["up"],
             title: ["{0}"],
             summaryInTitleRow: true,
             titleInFirstCol: true,
             fixCols: false,
        }
    },

and then i initialize the grid with the following:

initializePqGrid: function () {

        let grid = $($('.vc-railtrace-grid')[0]);
       

        grid.pqGrid({
            colModel: GS.RailTrace.search.pqGridSettings.columnModel,
            dataModel: GS.RailTrace.search.pqGridSettings.dataModel,
            groupModel: GS.RailTrace.search.pqGridSettings.groupModel,
            flexHeight: true,
            scrollModel: { autoFit: true },
            selectionModel: { type: 'row', mode: 'single' },
            hoverMode: 'row',
            title: '<b>' + GS.res.rail.RailCarEvent_Search_Result_Title + '</b>',
            stripeRows: true,
            columnBorders: true,
            roundCorners: false,
            numberCell: { show: false },
            showTop: true,
            editable: false,
            toolbar: {
                items: [
                    {
                        type: 'button',
                        label: GS.res.common.ExpandAllLabel,
                        icon: 'ui-icon-plus',
                        listener: function (e) {
                            var collapsed = grid.pqGrid("option", "groupModel.collapsed");
                            for (var i = 0; i < collapsed.length; i++) {
                                collapsed = false;
                            }
                            grid.pqGrid('refreshView');
                        }
                    },
                    {
                        type: 'button',
                        label: GS.res.common.CollapseAllLabel,
                        icon: 'ui-icon-minus',
                        listener: function (e) {
                            var collapsed = grid.pqGrid("option", "groupModel.collapsed");
                            for (var i = 0; i < collapsed.length; i++) {
                                collapsed = true;
                            }
                            grid.pqGrid('refreshView');
                        }
                    },
                ]
            }
        });
       
    },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Group Model static field
« Reply #1 on: March 12, 2019, 01:04:04 pm »
All group title rows have pq_gtitle as true, so you can add a condition in column.render callback

Code: [Select]
if ( ui.rowData.pq_gtitle ){
 //then display the icon.
}

joelclark

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Group Model static field
« Reply #2 on: March 12, 2019, 08:59:42 pm »
Thanks a ton for the quick reply!

Just out of curiosity is there documentation anywhere on what all the different attributes on the ui.rowdata are?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6122
    • View Profile
Re: Group Model static field
« Reply #3 on: March 12, 2019, 09:28:55 pm »