Column Freeze or Fixed Column in datatable

后端 未结 2 1320
故里飘歌
故里飘歌 2020-12-16 06:46

Is it possible to freeze first 3 columns of Primefaces\' data table?

I\'m using Primefaces 3.1

相关标签:
2条回答
  • 2020-12-16 07:15

    For those who are using Primefaces 4.1 or above, this feature is now implemented (it took four years from the first request, by the way):

    https://code.google.com/p/primefaces/issues/detail?id=366

    You can play with the horizontal scrolling in the showcase.

    0 讨论(0)
  • 2020-12-16 07:17

    Primefaces does not support fixed columns right now.

    Jquery fixed column was used to achieve the same. Reference : http://datatables.net/extras/fixedcolumns/

    Example:

    var oTable2 = $(primfacesDataTableId).find('table').dataTable({
                    "sScrollX" : "100%", //Scroll
                    "sScrollY" : "180",
                    "bAutoWidth" : false,
                    "bScrollCollapse" : true,
                    "bPaginate" : false,
                    "bSort" : false,
                    "sInfo" : "",
                    "sInfoEmpty" : ""
                });
    
    var oFC = new FixedColumns(oTable2, {
                        "iLeftColumns" : 4, //Freezed first for columns
                        "sHeightMatch" : "auto",
                        "iLeftWidth" : 405
                    });
    

    Thanks, Shikha

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