学生料金モジュールがあり、料金クラスを賢明に生成したいと考えています。特定の生徒ではなく、クラス全体の料金を生成することを意味します。DataTable
以下のようになります。
|RegistrationNo | Name | AdmissionFee | TutionFee | SportsFee | Exam Fee| Discount |
------------------------------------------------------------------------------------
| 50020 | A | 1000 | 800 | 500 | 400 | 300 |
| 50021 | B | 1000 | 800 | 500 | 400 | 100 |
など、クラス全体...
問題は、Fees
学校によって定義されているため、固定数の料金がないことです。たとえば、Transport Fee
定義Library Fee
することができ、定義することができ、学校が必要とする他の料金を定義することができます。したがって、これらの料金名はFeeDefination
テーブルから取得されます。aoColumns
次に、これらの料金を属性として追加する方法を説明します。以下のコードを試してみました...
var html = '[';
var oTable = $('#GenerateFeeDataTable').dataTable({
"bJQueryUI": true,
"bServerSide": true,
"bPaginate": false,
"bFilter": false,
"bInfo": false,
"sAjaxSource": "/forms/StudentFee/studentfee.aspx/GenerateStudentFee?CampusId=" + campusId + "&ClassId= " + classId + '&Session=' + JSON.stringify(session) + "&FeeModeId=" + feeModeId,
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": "GET",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"data": aoData,
"success": function (data) {
var data = data.d;
html += '{"sTitle":"Registration No","mDataProp":"RegistrationNo","bSearchable":false,"bSortable":false},';
html += '{"sTitle":"Student Name","mDataProp":"StudentName","bSearchable":false,"bSortable":false},';
html = html.substring(0, html.length - 1);
html += ']';
fnCallback(data);
}
});
},
"aoColumns": html
});
aoColumns
どのように属性を静的に取りましfnServerData
たが、これらは修正されません。機能するかどうかを試しているだけですが、機能しません..
My Questions are :
1) How to handle this situation, means how to add aoColumns dynamically.
2) How to get Header/Variables Name from JSON aaData, below is the Image to understand.
そのようなタスクを実行する方法はありますか?