Weird behavior using rowGroup & Buttons extension

Weird behavior using rowGroup & Buttons extension

alvindotnetdeveloperalvindotnetdeveloper Posts: 3Questions: 1Answers: 0

I am having trouble with correctly displaying contents in datatable. Basic functionality works fine but issue occurs when buttons (button extension) is clicked the datatable rowgroup is shifted to right side instead of hiding the columns which is specified in the button configuration. Seems like clicking button recalculates colspan and thus making all cells shift to right.

This is what I have done so far (jsfiddle) https://jsfiddle.net/wj5rac4d/ and jsfiddle.net/8n9xbLkd/

Any help is highly appreciated. Thanks
Stackoverflow: https://stackoverflow.com/q/55974038/7793817

Answers

  • allanallan Posts: 63,161Questions: 1Answers: 10,406 Site admin

    I think we are hitting this. When the column visibility is changed, RowGroup isn't currently taking into account that you might have defined your own columns for the grouping row.

    In fact I don't think your own code for the rendering callback is either - it doesn't check to see what columns are visible and alter the number of cells to be returned based on that.

    Allan

  • alvindotnetdeveloperalvindotnetdeveloper Posts: 3Questions: 1Answers: 0

    Thank for quick reply Allan. I used example from here. Any idea/workaround/example would be really helpful.

  • alvindotnetdeveloperalvindotnetdeveloper Posts: 3Questions: 1Answers: 0

    @allan I mean from here

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @alvindotnetdeveloper ,

    As Allan said, the startRender isn't considering which columns are hidden or not, so it's creating <td> elements for columns which aren't visible, thus screwing up those header rows.

    The fix would be in the startRender function, to call either column().visible() for each column, or columns().visible(), to determine whether that header column should be created.

    Cheers,

    Colin

This discussion has been closed.