【问题标题】:Freezing Table columns and rows using only one table仅使用一个表冻结表列和行
【发布时间】:2013-06-09 14:31:24
【问题描述】:

我有一个从应用程序填充的动态表。 我的问题是我需要一些方法来冻结第一行和前四列,但只使用一个表,显然是因为我会将表再次发布回应用程序。

我当前的表代码:

....
<form name="myform" method="post" action="test123.php" onsubmit="set_value();">
//this form is used to post back the data after user updates it.
<br /> 
<table align="center" id="dataTable">
<thead>
<tr class="header">
...
$arratt49 = (explode(',',$response49,-1)); //sending an array from application
$dayscounter = sizeof($arratt49);
$sizemon = strlen($month1);
if($sizemon > 0)
{
    echo "<th class='text ce6'>No.</th>";
    echo "<th class='text ce6'>Emp code</th>";
    echo "<th class='text ce6'>Name</th>";
    echo "<th class='text ce6'>Department </th>";
for($kkk=0;$kkk<$dayscounter;$kkk++)
    {
    echo "<th class='text ce7'>";
    echo $arratt49[$kkk];
    echo "</br>";
    echo $arratt49[$kkk+1];
    echo "</th>";
    $kkk = $kkk +1;
    }
}
</tr>
</thead>
<tbody>
<tr>
....//Here goes the Body
for($k=0;$k<=$arrcnt;$k++)
    {   
                echo "<td class='text ce2'>";
                echo $counter;
                echo "</td>";                   
                echo "<td class='text ce2'><INPUT type='text' name='code[]' size = '8' readonly='true 'value='";
                echo $arratt[$k];
                echo "'";
                echo "</td>";
                echo "<td class='text ce2'><INPUT type='text' name='name[]' size = '40' readonly='true' value='";
                echo $arratt[$k+1];
                echo "'";
                echo "</td>";
                echo "<td class='text ce2'><INPUT type='text' name='dept[]' size = '12' readonly='true 'value='";
                echo $arratt[$k+2];
                echo "'>";
                echo "</td>";

已经尝试过:
Big Four方法
还有This

有什么好主意吗? 我再次不能使用多个表格方法。

【问题讨论】:

  • 你可以使用插件数据表吗? datatables.net/release-datatables/extras/FixedColumns/…
  • @test1604 :感谢您的建议,我检查了,上述方法仅适用于列,我需要在同一个表中冻结 1 ROW 和 4 COLUMNS。
  • 你需要冻结页眉+第一行吗?
  • 标题(或第一行 + 4 第一列。
  • 我上传了一张图片,说明我想冻结的区域。

标签: php html scroll html-table freeze


【解决方案1】:

您可以使用数据表插件FixedColumns,只需将参数“iLeftColumns”设置为需要从表格左侧固定的列数。默认情况下,标头已固定。

【讨论】:

猜你喜欢
  • 2017-12-17
  • 2013-03-26
  • 1970-01-01
  • 1970-01-01
  • 2012-06-16
  • 2012-03-23
  • 1970-01-01
  • 2011-02-23
  • 1970-01-01
相关资源
最近更新 更多