Show Column Header on dragging column

前端 未结 2 1940
盖世英雄少女心
盖世英雄少女心 2020-12-01 23:26

i implement the code in GroupableHeader and try to enable the reordering allowed but i have two problems:

1: When dragging a column the header don´t see over the c

相关标签:
2条回答
  • 2020-12-01 23:47

    My predecessor also thought that using code they copied off the internet was a good idea...fortunately for my company, I don't

    I spent about 4 weeks of my spare time digging through the implementation and comparing it with the default BasicTableHeaderUI figuring out how to reinstate...

    • Column ordering, including, limiting the grouped columns to there group
    • Row sorting
    • Various other bits and pieces

    This is a incomplete solution, as I've not yet quite got to the point where when you drag a group and have it show all the columns in the group, but that's within the TableUI

    Draggable column groups

    Unfortunately, I can't paste the code, it's over the 3000 character limit, but you can grab a copy from here

    0 讨论(0)
  • 2020-12-01 23:48

    A bit more complete solution: JBroTable.

    It's based on MadProgrammer's answer. It restricts column dragging out of the group too. And brings some extra features:

    • Arbitrary number of rows
    • Natural API for model creation
    • Generic support for other L&Fs (Windows system L&F, GTK, Nimbus etc.)

    Sample model creation:

    IModelFieldGroup groups[] = new IModelFieldGroup[] {
      new ModelFieldGroup( "A", "A" )
        .withChild( new ModelField( "B", "B" ) )
        .withChild( new ModelField( "C", "C" ).withRowspan( 2 ) ), // Custom rowspan set.
      new ModelFieldGroup( "D", "D" )
        .withChild( new ModelField( "E", "E" ) )
        .withChild( new ModelField( "F", "F" ) ),
      new ModelField( "G", "G" ),
      new ModelFieldGroup( "H", "H" )
        .withChild( new ModelFieldGroup( "I", "I" )
                      .withChild( new ModelField( "J", "J" ) ) )
        .withChild( new ModelField( "K", "K" ) )
        .withChild( new ModelFieldGroup( "L", "L" )
                      .withChild( new ModelField( "M", "M" ) )
                      .withChild( new ModelField( "N", "N" ) ) )
    };
    

    Result:

    Result

    Animated demo (2.5M)

    Update:

    Added drawing of the whole dragged columns group.

    0 讨论(0)
提交回复
热议问题