5
HIフィルタ後に生徒を並べ替えようとしています。学生をフィルタリングした後、下の画像に示すように、ボタンとテキストのクラスクラスを追加しています。 私の動的なコードは、このようにHTMLを返します。追加後に動的テーブルデータを並べ替える方法
<tbody>
<tr>
<td><span><img></span><p>Rasmus1 Lerdorf</p><p><b>Hallticket</b> : S28J1</p></td>
<td style="line-height:45px">4</td>
<td style="line-height:45px">9</td>
<td style="line-height:45px">8</td>
<td style="line-height:45px">4.5</td>
<td><span id="stu28" class="btn btn-danger reject-student selection-class">Not Selected</span></td>
<td style="line-height:45px"><input class="overrideStudent" type="text" name="picomment[28]"></td>
</tr>
<tr>
<td><span><img></span><p>Bill Gates</p><p><b>Hallticket</b> : S29J1</p></td>
<td style="line-height:45px">9</td>
<td style="line-height:45px">10</td>
<td style="line-height:45px">8</td>
<td style="line-height:45px">6.1</td>
<td><span id="stu28" class="btn selection-class btn-success select-student">Selected</span></td>
<td style="line-height:45px"><input class="overrideStudent" type="text" name="picomment[29]"></td>
</tr>
</tbody>
私が最初に私はこれを行うことができますどのように選択した生徒を表示したいですか..?
これは私のjavascriptのコードです|:
success: function (response) {
$(".selection-class").addClass('btn-danger reject-student');
$(".selection-class").removeClass('btn-success select-student');
$(".selection-class").text('Not Selected');
$.each(response['students'], function(k, student) {
$("#stu"+student.student_id).removeClass('btn-danger reject-student');
$("#stu"+student.student_id).addClass('btn-success select-student');
$("#stu"+student.student_id).text('Student Selected');
});
$("#success_message").show();
$("#success_message").html(response['message']);
を、それを変更することができますあなたが記述している問題の実例を使って、フィドルやプランナーを提供する場合、人々は質問に答えます。例えば、上のコードは明らかに文脈から外れています。実際の例を提示すると、人々があなたを助けやすくなります – blubberbo