frtgbs07 / jquery-datatables-row-grouping

Automatically exported from code.google.com/p/jquery-datatables-row-grouping
0 stars 0 forks source link

"Native" expanded rows don't close #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If you use the native DataTables row expansion (fnOpen), the rows remain 
visible after collapsing a group

What is the expected output? What do you see instead?
Rows close automatically.

Please provide any additional information below.

I added this code in "_fnOnGroupClick" before "hide" :

$('.group-item-' + sGroup).each(function () {
   if (oTable.fnIsOpen(this)) {
      $(this.cells[0].children[0]).attr('src', '../../Images/details.png');
      oTable.fnClose(this);
   }
});

(My show/hide button needs its src changed before closing).

Works great! Might be good to include in both "hide" functions.

Bob Graham rvgraham789@sbcglobal.net

Original issue reported on code.google.com by rvg...@gmail.com on 2 Apr 2012 at 8:10

GoogleCodeExporter commented 9 years ago
Hi,

Thanks for this I will update plugin.

Is the $(this.cells[0].children[0]).attr('src', '../../Images/details.png'); 
necessary? I know that it is used to switch on/off open button but could we 
avoid hard-coding this image especially if someone want to use different name 
or file path in design? Do you know is there any more generic way to achieve 
this?

Regards,
Jovan

Original comment by joc...@gmail.com on 13 Jul 2012 at 3:42

GoogleCodeExporter commented 9 years ago

Original comment by joc...@gmail.com on 13 Jul 2012 at 10:50

GoogleCodeExporter commented 9 years ago
No, the src file for the expand/collapse button probably should be left to the 
user. . Our aded as an option on fnOpen/Close.

Original comment by rvg...@gmail.com on 14 Jul 2012 at 8:46

GoogleCodeExporter commented 9 years ago
Hi,

I have included this in version 1.2.2. However this custom code need to be 
placed in the fnOnRowClosed function parameter. There you can put whatever is 
specific in design. Below in new code:

if (oTable.fnIsOpen(this)) {
    if (properties.fnOnRowClosed != null) {
          properties.fnOnRowClosed(this);
          //    $(this.cells[0].children[0]).attr('src', '../../Images/details.png');
    }
    oTable.fnClose(this);
}

I hope that this will work in your code too. Just put something like a:

fnOnRowClosed: function(row) {
$(row.cells[0].children[0]).attr('src', '../../Images/details.png');
}

in the initialization.

Regards,
Jovan

Regards,
Jovan

Original comment by joc...@gmail.com on 15 Jul 2012 at 11:28

GoogleCodeExporter commented 9 years ago
Thanks Jovan. I'll uodate my apps!

Bob

Original comment by rvg...@gmail.com on 17 Jul 2012 at 5:03