0

プロジェクト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>

開発者からの回答はなく、フォーラムでも同様のものは見つかりませんでした。誰もが進む方法を知っていますか?

4

1 に答える 1

0

私は答えを持っています。このプラグインを使用し、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>

ところで、この問題を助けようとしたすべての人に感謝します:)

于 2014-04-29T14:20:38.033 に答える