aaData not working in jquery each statement ..
My scenario:
i m calling service and my succedded function is :
function ServiceSucceeded(result) {
if (DataType == "json") {
//alert(result);
var obj = jQuery.parseJSON(result);
if (obj != null) {
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
$('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sScrollY": "400px",
"aaData": [
jQuery.each(obj, function (key, value) {
if (key < 1)
{
[ "sda", "asd","weq","fgtre" ]
// here i m generating html controls as well.
}
}) // end of for each
],
//], // end of aaData
"aoColumns": [
{ "sTitle": '1', "sClass": "center", "sWidth": "15px" },
{ "sTitle": '2', "sClass": "center", "sWidth": "20px" },
{ "sTitle": '3', "sClass": "left", "sWidth": "250px" },
{ "sTitle": '4', "sClass": "left", "sWidth": "250px" }
] // end of aaColumns
});
when i run this [object Object] is showing in all columns.
Please help.
Regards,
Nitin Jambhale.
My scenario:
i m calling service and my succedded function is :
function ServiceSucceeded(result) {
if (DataType == "json") {
//alert(result);
var obj = jQuery.parseJSON(result);
if (obj != null) {
$('#demo').html('<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"></table>');
$('#example').dataTable({
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sScrollY": "400px",
"aaData": [
jQuery.each(obj, function (key, value) {
if (key < 1)
{
[ "sda", "asd","weq","fgtre" ]
// here i m generating html controls as well.
}
}) // end of for each
],
//], // end of aaData
"aoColumns": [
{ "sTitle": '1', "sClass": "center", "sWidth": "15px" },
{ "sTitle": '2', "sClass": "center", "sWidth": "20px" },
{ "sTitle": '3', "sClass": "left", "sWidth": "250px" },
{ "sTitle": '4', "sClass": "left", "sWidth": "250px" }
] // end of aaColumns
});
when i run this [object Object] is showing in all columns.
Please help.
Regards,
Nitin Jambhale.