2012-03-19 59 views
0

這裏的數據表後不適是jQuery腳本jQuery的數據表的功能呈現在<f:ajax>

<script type="text/javascript" charset="utf-8"> 
       var oTable; 
           $(document).ready(function() { 
            oTable = $('#example').dataTable({ 
            "bJQueryUI": true, 
            "sPaginationType": "full_numbers", 
            "bRetrieve": true 
             }); 
           }); 

           function datatable() 
           { 
            oTable.fnDestroy();                    
            oTable = $('#example').dataTable({ 
            "bJQueryUI": true, 
            "sPaginationType": "full_numbers", 
            "bRetrieve": true 
            }); 
           } 
      </script> 

這裏是模型PANAL腳本

$("#dialog-form").dialog({ 
        autoOpen: false, 
        show: "blind", 
        hide: "explode", 
        width: "400px", 
        modal: true , 
        buttons: { 
         "register-close" : function() { 
        $("#register").click(); 
        datatable(); 
        $(this).dialog("close"); 

        } 

     } 
      }); 

這裏是布通點擊代碼

<h:commandButton value="Register" action="#{employeeListBean.register}" id="register" style="display: none" onclick="alert('asdsa')" > 
           <f:ajax execute="userId password empName Address gender mobNo loginname" render=":example"/> 
          </h:commandButton> 

當我點擊那個按鈕編輯完成,數據表也現在渲染p問題在於jQuery數據表功能在渲染數據表後不適用於表格。

+0

,id爲「榜樣」? – 2012-03-19 09:54:49

回答

1

你需要在AJAX事件再次申請表()渲染,

添加此代碼...

如果你看看僅有一名錶螢火
$(window).load(function() { 
    jsf.ajax.addOnEvent(function (data) { 
     if (data.status === "success") { 
      oTable = $('#example').dataTable({ 
        "bJQueryUI": true, 
         "sPaginationType": "full_numbers", 
         "bRetrieve": true 
      }); 
     } 
    } 
}); 
+0

但仍然存在一個問題,那就是舊數據表的頁眉和頁腳是否仍然是 – 2012-03-19 12:20:44

+0

,並且沒有我建議的補充,舊數據表的頁眉和頁腳是否剩餘? – Daniel 2012-03-19 12:22:38