Author Topic: Error when setting href link on a group total column  (Read 3143 times)

pbassey

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 54
    • View Profile
Error when setting href link on a group total column
« on: February 17, 2025, 10:11:48 pm »
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?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6373
    • View Profile
Re: Error when setting href link on a group total column
« Reply #1 on: February 18, 2025, 02:40:44 pm »
Apparently column render looks fine in your code and I don't see any reason why it would raise that error.

Could you share a jsfiddle / stackblitz reproducing the error.

pbassey

  • Pro Ultimate
  • Jr. Member
  • *
  • Posts: 54
    • View Profile
Re: Error when setting href link on a group total column
« Reply #2 on: February 18, 2025, 09:24:20 pm »
just to clarify, the error is occurring when I click on the rendered link, not when the grid is rendered...

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6373
    • View Profile
Re: Error when setting href link on a group total column
« Reply #3 on: February 18, 2025, 10:58:14 pm »
you need to check code in OpenTranWindow function and use Group().option() method to set groupModel options.

https://paramquery.com/pro/api#method-Group