Author Topic: Grouping: remove/hide the text in the grouped column detail rows  (Read 5545 times)

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #15 on: July 03, 2023, 10:09:54 pm »
First define custom aggregate, you can name it anything.

Code: [Select]
pq.aggregate.mycustom = function( arr ){
return arr[ 0 ];
}

Then use it similar to inbuilt aggregates:

Code: [Select]
this.getColumn({ dataIndx: 'ProjectField1' }).summary = { type: 'mycustom' };

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #16 on: July 06, 2023, 06:26:40 pm »
thank you. I defined the custom aggregate and tried to use it in the groupChange function but get the attached error.


$gridMain.aggregate.mycustom = function (arr) {
   return arr[0];
}

groupChange: function () {
     var GMDI = this.option('groupModel.dataIndx');
     if (GMDI.indexOf('proj') == 0 ) { //if grouped by project
          this.getColumn({ dataIndx: 'ProjectField' }).summary = { type: 'mycustom' };
       }
},

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #17 on: July 06, 2023, 07:15:36 pm »
$gridMain.aggregate.mycustom is incorrect.

It's pq.aggregate.mycustom, pq.aggregate is the namespace and 'mycustom' can be named anything.
« Last Edit: July 06, 2023, 07:35:31 pm by paramvir »

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #18 on: July 06, 2023, 07:41:40 pm »
can you put the project name in the group row in this example?
https://jsfiddle.net/94wvjse1/


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #19 on: July 09, 2023, 06:24:07 pm »

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #20 on: July 09, 2023, 07:50:43 pm »
thanks. I now need to make the custom summary dynamic based on the column being grouped, which is where I'm getting the error attached previously. Can you update the file to only apply the summary when grouping by rank? I tried in the group change event but get an error.
 
https://jsfiddle.net/gf3s2xdj/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #21 on: July 09, 2023, 09:49:00 pm »
Code: [Select]
groupChange: function() {
//debugger;
  var GMDI = this.option('groupModel.dataIndx');
  this.getColumn({
    dataIndx: 'company'
  }).summary = (GMDI.indexOf('rank') == -1) ? null : {
    type: 'mycustom'
  };
},

Please check this:

https://jsfiddle.net/nbka5yew/

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #22 on: August 20, 2024, 02:09:52 am »
How can I update this column, to not show anything in the summary rows when grouped?
                    {
                        title: "Project Actions", width: 140,
                        editor: {
                            type: 'select',
                            options: ['', 'View/Edit project details', 'Add Resources', 'Create an Issue/Escalation', 'Edit Timeline Status', 'History/Comment'],
                        },
                        cls: 'pq-drop-icon pq-side-icon',
                        render: function (ui) { return '<a style="color:blue" >Actions</a>' }
                    },

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #23 on: August 20, 2024, 08:53:10 pm »
https://paramquery.com/pro/tutorial#topic-metadata

By excluding rows having pq_gsummary in render callback.

Code: [Select]
if( !ui.rowData.pq_gsummary ){
   return '<a style="color:blue" >Actions</a>'
 }

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #24 on: August 21, 2024, 05:48:34 pm »
thank you.
-none of the rows have a value for pq_gsummary (see attachment)
-if the user were to click this column in the summary row, would they see the drop down values? I don't want that to happen


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #25 on: August 21, 2024, 07:28:26 pm »
Quote
How can I update this column, to not show anything in the summary rows when grouped?

Where have you defined the summary rows?

mikep

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 163
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #26 on: August 21, 2024, 07:45:40 pm »
groupModel: groupModel

                var groupModel = {
                    on: true,
                    title: ["{0} ", "{0} "],
                    summaryEdit: false,
                    headerMenu: false,
                    indent: 20,
                    summaryInTitleRow: 'all', //to display summary in the title row.
                   dataIndx: ["ResourceType", "proj"],
                   collapsed: [false]
                };

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6307
    • View Profile
Re: Grouping: remove/hide the text in the grouped column detail rows
« Reply #27 on: August 23, 2024, 12:44:42 pm »
In that case, it's pq_gtitle instead of pq_gsummary

Also change the column editor from static object to callback that returns object conditionally depending upon ui.rowData.pq_gtitle value.

Example of conditional editors is here: https://paramquery.com/pro/demos/editors_conditional

Please share a jsfiddle if still facing issues.