我有一个学生费用模块,我想明智地生成费用课程。意味着为整个班级产生费用,而不是为特定学生。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.
有没有办法做这样的任务,任何帮助..