0

我正在使用 Primefaces 3.5RC。我在实现以下 JS 函数以使我能够冻结数据表上的列时遇到问题。我还是 JS 新手,不知道如何在 StackOverflow 上找到的示例 JS 函数中引用我的 dataTable id:Column Freeze or Fixed Column in datatable。任何帮助或建议将不胜感激。谢谢。

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
            });
4

1 回答 1

0

Usually you refer the Primeface/JSF components from the parent form component.
For Example:

If you have following code:

<h:form id="myForm">
    <p:dataTable id="myTable">
       .....
    </p:dataTable>
</h:form>

Refer your DataTable as:

myForm:myTable

Or you can get it from Firebug Console in your browser.

While you are referring to the component form JQuery use:

$("[id='myForm:myTable']")
于 2013-11-08T04:22:51.330 回答