Open Grouped Query with 1st Group expanded and the rest collapsed

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Open Grouped Query with 1st Group expanded and the rest collapsed

Post by Jhstephenson »

I could swear I saw something about this in a post once, but can't find it now.

I have a query with groups that I would like to have open up with the first group expanded automatically, but the rest closed.

Is that possible?
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Open Grouped Query with 1st Group expanded and the rest collapsed

Post by Jaymer »

Search for “Jaymertip expand”
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Jhstephenson
Posts: 297
Joined: Wed Apr 22, 2015 11:44 pm

Re: Open Grouped Query with 1st Group expanded and the rest collapsed

Post by Jhstephenson »

Thanks Jaymer, I tried that and it doesn't open the row I want.

This is what I ended up putting in the render script:

var grid = widget;
grid.bind("dataBound", expand);

function expand(e) {
var row = $("#" + grid.element.attr("id") + ' tr[class="k-grouping-row"]');
grid.expandRow(row[0]);
}

I do have the Group set to be collapsed initially. I tried it with that option unchecked and it opened all of the groups just like it normally woudl.

Am I missing something here?
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Open Grouped Query with 1st Group expanded and the rest collapsed

Post by Jaymer »

your code uses some double quotes, where mine has single.
thats 1 diff. i see - no idea if that makes a difference

also, after the row variable gets set, you can try
console.log(row);

and see what prints.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
Post Reply