简体   繁体   English

PrimeFaces Js在xhtml页面中的集成

[英]PrimeFaces Js integration within an xhtml page

I'm using Primefaces 3.5RC. 我正在使用Primefaces 3.5RC。 I am having trouble implementing the following JS function to enable me to freeze columns on a dataTable. 我在实现以下JS函数以使我能够冻结dataTable上的列时遇到麻烦。 I'm still new to JS and don't know how I should reference my dataTable id within the Example JS functions below that I found on StackOverflow: Column Freeze or Fixed Column in datatable . 我对JS还是很陌生,不知道如何在我在StackOverflow上发现的以下示例JS函数中引用我的dataTable id: datatable中的Column Freeze或Fixed Column Any help or suggestions will be greatly appreciated. 任何帮助或建议,将不胜感激。 Thanks. 谢谢。

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

Usually you refer the Primeface/JSF components from the parent form component. 通常,您从父表单组件引用Primeface / JSF组件。
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. 或者,您可以从浏览器的Firebug控制台中获取它。

While you are referring to the component form JQuery use: 当您引用JQuery组件形式时,请使用:

$("[id='myForm:myTable']")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM