我正在使用 Jquery UI DataTable,它在select(DropDown)
change
事件中填充。PageLoad
就可以了。当我执行dropdown change
事件时,DataTable
是Reinitialized
通过使用fnDestroy()
,但格式发生了DataTable
变化。下面是我的代码..
campusChangeEvent = function () {
$('#cmbClassCP').on('change', function () {
$('#ClassRegistredDataTable').dataTable().fnDestroy();
GetAllClassbyCampus($('#cmbClassCP :selected').val());
});
},
GetAllClassbyCampus = function (id) {
var oTable = $('#ClassRegistredDataTable').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"bServerSide": true,
"bRetrieve": true,
"bDestroy": true,
"sAjaxSource": "/forms/Setup/Setup.aspx/GetAllClassBycampus?CampusId=" + id,
"fnServerData": function (sSource, aoData, fnCallback) {
$.ajax({
"type": "GET",
"dataType": 'json',
"contentType": "application/json; charset=utf-8",
"url": sSource,
"data": aoData,
"success": function (data) {
fnCallback(data.d);
}
});
},
"aoColumns": [
{
"mDataProp": "RowNo",
"bSearchable": false,
"bSortable": false,
"sWidth": "20"
},
{
"mDataProp": "CampusName",
"bSearchable": false,
"bSortable": false,
},
{
"mDataProp": "ClassName",
"bSearchable": true,
"bSortable": false
},
{
"mDataProp": "Section",
"bSearchable": false,
"bSortable": false
},
{
"mDataProp": "Description",
"bSearchable": false,
"bSortable": false
},
{
"mData": null,
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj) {
return '<a class="edit" href="">Edit</a>';
}
}
]
});
我的表格看起来Page Load
像..
更改事件后DropDown
,如下所示..
任何帮助....