ASP.NET Dynamic Data Website: Microsoft JScript runtime error
ASP.NET Dynamic Data Website: Microsoft JScript runtime error
MIT560
Posts: 4Questions: 0Answers: 0
Hello,
Has anyone else run into the following error?
[quote]Microsoft JScript runtime error: Unable to get value of the property 'asSorting': object is null or undefined[/quote]
I am using ASP.NET's Dynamic Data templates and this error is being thrown from the DataTables plugin at line 7272. It seems to only happen if the table is null.
Here is the JavaScript I am using to initialize the plugin on the table. Also of note the jQuery button statement is not being applied as well. They both work on pages that have records returned.
[code]
$(document).ready(function () {
var oTable = $("div.AspNet-GridView table").dataTable({
"bJQueryUI": true,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"sPaginationType": "full_numbers"
}).fnFilterOnReturn();
$(".button-insert").button({
icons: {
primary: "ui-icon-plusthick"
}
});
});
[/code]
Here is the rendered html that is displaying for the table.
[code]
[/code]
Could this be due to the fact that the table is rendering without any TH tags and the script is looking for some to apply the sorting methods to?
Thanks for your help in advance.
Regards,
MIT560
Has anyone else run into the following error?
[quote]Microsoft JScript runtime error: Unable to get value of the property 'asSorting': object is null or undefined[/quote]
I am using ASP.NET's Dynamic Data templates and this error is being thrown from the DataTables plugin at line 7272. It seems to only happen if the table is null.
Here is the JavaScript I am using to initialize the plugin on the table. Also of note the jQuery button statement is not being applied as well. They both work on pages that have records returned.
[code]
$(document).ready(function () {
var oTable = $("div.AspNet-GridView table").dataTable({
"bJQueryUI": true,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"sPaginationType": "full_numbers"
}).fnFilterOnReturn();
$(".button-insert").button({
icons: {
primary: "ui-icon-plusthick"
}
});
});
[/code]
Here is the rendered html that is displaying for the table.
[code]
[/code]
Could this be due to the fact that the table is rendering without any TH tags and the script is looking for some to apply the sorting methods to?
Thanks for your help in advance.
Regards,
MIT560
This discussion has been closed.
Replies
[code]
$(document).ready(function () {
intTable();
})
function intTable() {
var rowCount = $('div.AspNet-GridView table tr').length;
if (rowCount != 0) {
var oTable = $("div.AspNet-GridView table").dataTable({
"bJQueryUI": true,
"bFilter": true,
"bSort": true,
"bInfo": false,
"bAutoWidth": false,
"sPaginationType": "full_numbers"
}).fnFilterOnReturn();
};
}
[/code]
Due to Dynamic Data's nature I cannot create a table with headers easily so I chose to fix it this way. If there is a better way feel free to post it here or at http://www.mit560.com/2011/08/19/206
Regards,
MIT560
Regards,
MIT560
[code]
<%--***NOTE... THE CSS STYLESHEET REFERENCED ON THE NEXT LINE DEFINES STYLES
REQUIRED ONLY BY THIS REPORT. DO NOT CHANGE THIS BLOCK OF HTML. --%>
$(document).ready(function () {
$('#GridView1').dataTable();
});
<%-- --%>
[/code]
Is zero configuration but i can't get my datatable... :( help please.