mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.82k stars 1.98k forks source link

expand\collapse of group issue #1075

Open sundertinwar opened 9 years ago

sundertinwar commented 9 years ago

I was working with grouping in slickgrid. When I expand and collapse groups I see that UI is not rendering properly and some rows are not visible at all.

http://jsfiddle.net/sunder_tiwnar/ywzkgwva/

http://mleibman.github.io/SlickGrid/examples/example-grouping For example open any of link, go to last group expand it. Then expand group above it, then expand group above it. Carefully notice that some rows will not be visible. In first link you can notice that group ninth will go away. I can help to reproduce this bug in all browsers.

Any solution?

Thanks

6pac commented 9 years ago

Could you test and see if there is still a problem with the version in my 'alternative master' repo (also see the wiki). I may have fixed this. I notice that in your example, when I expand and collapse, I get two totals rows. I think that is what is 'eating' a regular row.

sundertinwar commented 9 years ago

Yes I can reproduce same with new repository. Here are snapshots in sequence number. I can follow below steps and reproduce it on any group level. 1 2 3 4 As you can clearly see, in first image I have collapsed all groups. Second image, I have expanded last group which have 2 items but shows only 1. Third image, in order to see two items in last group, I have to expand its parent which also show just 3 items instead of 4 items. And in fourth image, when i collapse its parent then finally it will show last group with two items.

Let me know how it can be fixed?

6pac commented 9 years ago

Thanks for trying that. I have a highly customised fork of SlickGrid (not the repo above) that I use for my own projects. I seem to recall finding and fixing a bug like this 18 months ago when I was rebuilding the grouping code. I'm in the process of trying to create a 'commit bridge' between the two forks now. I'll let you know if I can work it out, or if I find the fix in the other fork.

sundertinwar commented 9 years ago

Thanks, I appreciate your quick reply. Please do check with your private repository and let me know what can be fix for this issue. Keen to hear back from you.

6pac commented 9 years ago

I notice that you're using the mleibman.github.io files for the example and in your jsfiddle. I can reproduce the problem there, but that is not the main repo and could be an old code version.

Can you try downloading the main repo code (if you want jquery ~1.8) or my alternate master repo (if you want up to date jquery) and try locally. I have copied your jsfiddle to a file in my local examples folder in my main repo and can't reproduce the problem. The elements are in the wrong order, but grouping works fine.

6pac commented 9 years ago

This could well be due to the DataView bug in the main trunk:

function calculateTotals(totals) {
  var group = totals.group;
  var gi = groupingInfos[group.level];
  var isLeafLevel = (group.level == groupingInfos.length);
  var agg, idx = gi.aggregators.length;

  if (!isLeafLevel && gi.aggregateChildGroups) {
    // make sure all the subgroups are calculated
    var i = group.groups.length;
    while (i--) {
      if (!group.groups[i].initialized) {
        calculateTotals(group.groups[i]);
      }
    }
  }

the last section should read:

      if (!group.groups[i].totals.initialized) {
        calculateTotals(group.groups[i].totals);
      }

It's precisely bugs like this that made me put the 'alternative master' repo together.

6pac commented 9 years ago

I have set up a Github pages site for my repo as well. Now you can check out the grouping example live: http://6pac.github.io/SlickGrid/examples/example-grouping