Jump to content
  • 0

Put the topmost record of a group in the corresponding collapsible row


TroubleShooter

Question

Hi,

 

I hope the title speaks for itself. It's a bit difficult to explain in words so I'll just present it visually.

 

So I have this Tabular Report DataPage with Grouping and Aggregation.

image.thumb.png.b8a72cae20fcaa87ea6bb49ca1119b75.png

 

 

What I wanted to do is to be able to pull the first record and put it in it's corresponding collapsible column. As demonstrated above.

And I hope it will remain that way even if I collapse the whole row.

 

image.thumb.png.99388e0f21e324dc37e6257fdefbec61.png

 

 Calling out the masters in customization. I hope you hear my call of help.

 

Many thanks in advance,

TroubleShooter

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hello once again TroubleShooter,

 

You ask such challenging/brain-teasing problems. Luckily I had my power-ups tonight and I am up for this challenge.

I am able to find a somewhat viable solution.

 

I hope the code speaks for itself too. *kidding*.  So paste>modify these code snippets in their respective places. Make sure that HTML Editor is disabled from the advanced tab.

 

Note: This only works for Level1 Grouping and it works best if you put the title (i.e. details) field in the end. I need more time to customize this solution further. 

 

Header

<script>

var init = [];
var temp = (new Date).toLocaleString() + "1AmD3f1n1t3lyN0t31337!";
  
function comparaPush(groupByField, titleField) {
  if (temp != groupByField)
  init.push(titleField);
  
  
var temp = groupByField;
  
}

</script>

 

HTML Block (*modification needed) [Regarding placement, there's only one room for error. 1/#OfFields]

<script>
  
var groupByField = "[@field:category]"; //This is your Grouping Field
var titleField = "[@field:details]"; //And this is your Title Field. The one that you'd be putting on your collapsible row
  
comparaPush(groupByField, titleField);

</script>

 

Footer

<script>

var groups = document.querySelectorAll(`[data-cb-name="group1"]`);

groups.forEach(rowalize);

function rowalize(elem, idx) {
elem = elem.firstChild;
elem.colSpan-=1;


elem.insertAdjacentHTML('afterend', `<td class="cbResultSetGroup1Label cbResultSetGroup1LabelCellNumberDate">${init[idx]}</td>`)

}


</script>

 

Hope this works for you. Happy Hacking!


Cheers,
DN31337

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...