titre du regroupement qui disparaît quand on clic dessus

titre du regroupement qui disparaît quand on clic dessus

briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

Bonjour,

J'ai utilisé dataTable pour y intégrer mon tableau dedans.
J'ai utilisé les rowGrouping pour regrouper sur les valeurs d'une colonne.
Sauf que comme dans l'exemple : https://datatables.net/examples/advanced_init/row_grouping.html , quand je clique part exemple sur Edinburgh, le titre Edinburgh disparaît.
J'aimerais que les titres restent.
Comment faire?

Merci,

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    In that example, the click just changes the ordering, you can remove the code at the bottom of the page if you don't want that behaviour - it's just there as an example.

    Colin

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    Thank you,

    What I want is that when we click on Edinburgh for example. The Edinburgh news disappears, but the Edinburgh name remains visible.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    I'm sorry, I'm not following. Could you give step-by-step instructions on what you would like to happen, please?

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    take the example of the link above, I understand that it just changes the order. Ok. But is it possible that when we click on the grouping like Edinburgh (I do not change the order, so I remove the code of inversement;)) But that the information of the grouping is hide ( as a drop-down menu).

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394

    @Colin - I think the op wants an accordion effect.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    edited November 2019

    Ah, thanks, do you mean something like example this from this thread?

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    Yes that's exactly right, thanks to you :)
    Do you have to put data-search and data-order in the html to do something?
    Because I do not see how I can put them in my html.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    Do you have to put data-search and data-order in the html to do something?

    No, it works without it too.

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    Great, the grouping works.
    Can I still again ask you a question?
    Can I now group in my first group on another column of the table?

    Thank you very much.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    You can group on two columns, if that's what you mean - see here.

    Colin

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    Yes that's exactly it.
    It works well when the value is an integer.
    But, my value is for example : "503 xxx" where xxx is a alphabetic character.
    And here, he can not sort with 503.
    is there a solution.

    Thank you.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    rowGroup.dataSrc can be a function, as in this example here. You could use that to strip out your "xxx" after the error code.

    Colin

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    For that to be more easier, I have add one column with the integer value.
    Therefore in my values I have for example 503.
    If I do dataSrc: [ 2, 1 ] , group equals Undefined .
    I want 2 accordion effect.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Could you create a test case for this, please, it'll help understand what you're after. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0
    edited December 2019

    Ok,

    Here is what I currently have :
    http://live.datatables.net/pojewila/4
    http://live.datatables.net/pojewila/4/edit

    There I am grouping for example by City.
    Now in a city, for example, I want to group by the ages.
    For example in Edinburgh, the 2 "22 years" will be grouped together ... with an accordion effect.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    The problems were
    1. you were using an old version of RowGroup before multi-level grouping was adding
    2. you weren't also sorting on the second grouping column.

    See updated test case here: http://live.datatables.net/pojewila/5/edit

    Colin

  • briciou62500briciou62500 Posts: 9Questions: 1Answers: 0

    It's good,
    But I can not click on the groups.
    And my groups is no longer folded.

    It is possible ?

This discussion has been closed.