1

これが可能かどうかはわかりませんが、私の能力を超えています。

ブラウザの設定ボタンを使用してSQLクエリから生成されたテーブルをフィルタリングしたい。つまり、タスクが完了したかどうかのチェックボックスと、時間枠(たとえば、過去24時間、週から日付、日付範囲など)のラジオボタンがあります。 ..)。常にページを更新することなくすべて。

誰かが私を正しい方向に向けることができますか?私は誰かに私のためにそれをするように求めているのではありませんが、私は独学であり、いくつかのガイダンスが必要です。助けていただければ幸いです。

これらは私が使用したいフィルターです:

        <form  id="filters">
            <input type="checkbox" id="live" name="filter_live" value="Live" /> <label for="live">Outstanding</label>
            <input type="checkbox" id="completed" name="filter_completed" value="completed" /> <label for="completed">Complete</label>
            |
            <input type="radio" id="last24" name="filter_radio" checked="checked" onchange="return hide_range(this.checked);"/><label for="last24">Last 24hrs</label>
            <input type="radio" id="WTD" name="filter_radio" onchange="return hide_range(this.checked);"/><label for="WTD">WTD</label>
            <input type="radio" id="last_week" name="filter_radio" onchange="return hide_range(this.checked);"/><label for="last_week">Last Week</label>
            <input type="radio" id="range" name="filter_radio" onchange="return show_range(this.checked);" /><label for="range">Range</label>
                <div id="date_range" style="display: none;">
                    <br />
            <label for="from">From: </label><input type="text" id="from" name="from"/>
            <label for="to">To: </label><input type="text" id="to" name="to" />
            <input type="button" value="Go" />

                </div>
        </form>

次の表でそれらを使用したいと思います。

 <table class="general">
        <tr>
            <th colspan='8'>Current Tasks</th>
        </tr>
            <tr>
                <th>Created</th>
                <th>Updated</th>
                <th>Location</th>
                <th>Task</th>
                <th>Priority</th>
                <th>Status</th>
                <th>Completed</th>
                <th>Action</th>
            </tr>
<?php
    while($row = mysql_fetch_array($eng_result)) :  ?>

            <tr>
<form action="Eng_update.php" method="post">

 <td><?php if($row['Created'] == NULL){echo "";}else{ echo date("d/m/y",  $row['created_ts']);} ?></td>
<td><?php if($row['LastModified']==NULL){echo "";} else {echo date("d/m/y", $row['Last_Modified_ts']);} ?></td>
<td><?php echo $row['Location'] ?><input type="hidden" name ="eng_loc[]" value="<?php echo $row['Location']; ?>" /></td>
<td><?php echo $row['Task'] ?><input type="hidden" name="eng_task[]" value="<?php echo $row['Task']; ?>" /></td>
<td><?php echo $row['Priority'] ?><input type="hidden" name="eng_priority[]" value="<?php echo $row['Priority']; ?>"</td>
<td><?php echo $row['Status'] ?><input type="hidden" name="eng_status[]" value="<?php echo $row['Status']; ?>"</td>
<td>
    <?php if($row['Completed']==1){echo "yes";} else {echo "no";}?>
    <input type="hidden" name="eng_task_complete[]" value="<?php echo $row['Completed'];?>"
</td>
    <td>
        <input type="hidden" name="update_id[]" value="<?php echo $row['ID']; ?>" />
        <input type="submit" value="Update" onClick="return checkAction('Do you wish to update the status of this task?')"/>

    </td>
</form>
            </tr>
<?php endwhile; ?>

    </table>

見てくれてありがとう:)

4

1 に答える 1

5

DataTables と呼ばれる jquery プラグインがあります (JQuery に精通している場合、これは簡単に使用できます): http://datatables.net/

データをソート/フィルタリングするための多くの機能があり、(AJAX を介して) データを動的にロードするオプションさえあります。

次のような機能が必要だと思います: http://datatables.net/release-datatables/examples/api/multi_filter.html

編集: 日付範囲については、カスタムの並べ替え関数を作成します。同様の質問がここで回答されています: http://www.datatables.net/forums/discussion/7218/sort-column-by-numerical-range/p1

于 2012-12-18T14:23:14.790 に答える