• Resolved mikeprince

    (@mikeprince)


    Are Row Grouping and Column Counter compatible? I can’t get them to work together, although both work on their own.

    The linked page shows a table using shortcode
    [table id=3 datatables_counter_column=true datatables_rowgrouping={iGroupingColumnIndex:1} /]
    The table has a blank first column for the Counter, and the Row Grouping column is the second column. The grouping has worked fine, but the counter column is blank. If I use just
    [table id=3 datatables_counter_column=true /]
    then the counter column does work ok.

    Any idea how I can get these to work together?

    • This topic was modified 4 years, 7 months ago by mikeprince.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, I’ll have to disappoint you here. These two Extensions are not compatible, as the Counter Column Extension can’t really handle those extra rows for the groups, sorry.

    As a side note: You seem to have added the table Shortcode into a “Preformatted” block, which causes wrong styling and fonts. Please place the table Shortcode into an actual “Shortcode” block instead.

    Regards,
    Tobias

    Thread Starter mikeprince

    (@mikeprince)

    Ah, a shame. It would be ideal if the Counter Column Extension could just ignore grouped rows, e.g.

    Group 1
    1
    2
    Group 2
    3
    4
    5
    Group 3
    6

    One for the wishlist ??

    Thanks for the note about the block: this was just a quick test, but I have changed it anyway.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, I this. This would indeed be nice. Maybe it will be possible in the future.

    All the best!
    Tobias

    Thread Starter mikeprince

    (@mikeprince)

    I thought I’d have a look at the code for this. I see if both extensions are being used and specified in the shortcode then actually only Row Grouping is actually activated (i.e. has its JavaScript code injected to the page). I assume this is something to do with the filter priorities for tablepress_datatables_command being the same for both: Counter Column is applied first but overridden by Row Grouping?

    How can I get both to be activated at the same time?

    I’m hoping then it’s not difficult to updated Counter Column to ignore any grouped rows.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, they are overriding each other, because they both add code after the DataTable() function call.

    Your best chance might be to create a modified Row Grouping Extension (using the DataTables add-on) yourself (the other TablePress Extensions that such such add-ons could serve as examples). That way, the (new) Row Grouping Extension would no longer have to modify the DataTable() call, so that the Counter Column Extension would be the only one doing that.

    Alternatively, you could look into manually calling the DataTables library with the relevant JS code. For that, you’d first have to get the JS calls from the HTML page source for each of the two Extensions, and merge it. Then, to apply it, you would turn off DataTables and the Extensions completely. TablePress would then only deliver the HTML code for the table, and you could add that new JS code to the page manually.

    Regards,
    Tobias

    Thread Starter mikeprince

    (@mikeprince)

    Well, that was easier than I expected! I’ve produced a new Row Group extension based on https://www.datatables.net/extensions/rowgroup/. It supports the optional dataSrc parameter to indicate which column to group on.

    The Counter Column extension works fine with this.

    I’ll email the extension to you. You’re welcome to tweak and publish as you wish!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks, that would be great ??

    Best wishes,
    Tobias

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Row Grouping and Column Counter?’ is closed to new replies.