簡體   English   中英

是否可以在“ fixheadertable”插件中使用AJAX數據?

[英]Is it possible to use AJAX data within “fixheadertable” plugin?

我在項目http://www.tablefixedheader.com/上使用了此插件,但在創建表時需要放置一些動態數據。

構建表的Js代碼為:

<script type="text/javascript">
    $.ajax({
            url: 'dialogs/WMS/mytable.php',
            success: function(data) {
                $('.maintab<?php echo $varc ?>
                ').html(data).fixheadertable({
                   colratio : [45, 24, 24, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150 ],
                   zebra : true,
                   sortable : true,
                   sortedColId : 3,
                   resizeCol : true,
                   height  : 150,
                   pager : true,
                   sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
                });
                            }
    });
</script>

我需要包括一些參數。 我試過的

示例1(沒有成功)

<script type="text/javascript">
     $.ajax({
      url:'dialogs/mytable.php?columns='<?php echo $column ?>,
      type: 'post',
      success: function(data) {
      $('.maintab<?php echo $varc ?>
       ').html(data).fixheadertable({
       colratio : [45, 24, 24, 180, 180, 180, 180, 180,180, 180, 180, 180, 180, 180]
       zebra : true,
       sortable : true,
       sortedColId : 3,
       resizeCol : true,
       height  : 150,
       pager : true,
       sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
       });
       }
       });
     </script>

示例2(沒有成功)

<script type="text/javascript">
     $.ajax({
      url:'dialogs//mytable.php?columns='<?php $column ?>,
      type: 'post',
      success: function(data) {
      $('.maintab<?php echo $varc ?>
       ').html(data).fixheadertable({
       colratio : [45, 24, 24, 180, 180, 180, 180, 180,180, 180, 180, 180, 180, 180],
       zebra : true,
       sortable : true,
       sortedColId : 3,
       resizeCol : true,
       height  : 150,
       pager : true,
       sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
       });
       }
       });
     </script>

示例3(沒有成功)

<script type="text/javascript">
 $.ajax({
  url:'dialogs/mytable.php',
   data: {
   columns: <?php echo $column ?>,
  }
  type: 'post',
  success: function(data) {
  $('.maintab<?php echo $varc ?>
   ').html(data).fixheadertable({
   colratio : [45, 24, 24, 180, 180, 180, 180, 180,180, 180, 180, 180, 180, 180],
   zebra : true,
   sortable : true,
   sortedColId : 3,
   resizeCol : true,
   height  : 150,
   pager : true,
   sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
   });
   }
   });
 </script>

示例4(沒有成功)

<script type="text/javascript">
 $.ajax({
  url:'dialogs/mytable.php',
   data: {
   columns: <?php $column ?>,
  }
  type: 'post',
  success: function(data) {
  $('.maintab<?php echo $varc ?>
   ').html(data).fixheadertable({
   colratio : [45, 24, 24, 180, 180, 180, 180, 180,180, 180, 180, 180, 180, 180],
   zebra : true,
   sortable : true,
   sortedColId : 3,
   resizeCol : true,
   height  : 150,
   pager : true,
   sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
   });
   }
   });
 </script>

沒有來自開發人員的解答,也沒有在論壇上找到類似的答案。 有人知道如何進行嗎?

我有答案。 使用此插件並需要數據庫將數據與AJAX數據推送給誰,您應該繼續執行以下操作:

<script type="text/javascript">
 $.ajax({
  url:'dialogs/mytable.php',
   data:{view: view,
        columns : '<?php echo $columns; ?>',
        },
  type: 'post',
  success: function(data) {
  $('.maintab<?php echo $varc ?>
   ').html(data).fixheadertable({
   colratio : [45, 24, 24, 180, 180, 180, 180, 180,180, 180, 180, 180, 180, 180],
   zebra : true,
   sortable : true,
   sortedColId : 3,
   resizeCol : true,
   height  : 150,
   pager : true,
   sortType : ['integer', 'string', 'string', 'string', 'string', 'date']
   });
   }
   });
 </script>

順便說一句,感謝所有嘗試幫助解決此問題的人:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM