unable to load json object - please help
unable to load json object - please help
tae
Posts: 1Questions: 0Answers: 0
hi all.
i have been trying to implement your plugin.
some far very nice :)
we have just one major issue, we cannot seem to bind a json object to the dataTable.
we need to be able to get a json object independently from server side and then rebind it to the table.
we cannot seem to achieve this. in one of our attempts we are only able to see [object object] instead of the actual data.
here is what we did:
[code]
// this simulates the server response:
var data = '[{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"4","col2":"42","col3":"43","col4":"44","col5":"45"}]';
data = $.parseJSON(data);
$(document).ready(function ()
{
$('#example').dataTable({
"bPaginate": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sUrl": "dataTables.hebrew.txt",
"sProcessing": "מעבד...",
"sLengthMenu": "הצג _MENU_ פריטים",
"sZeroRecords": "לא נמצאו רשומות מתאימות",
"sInfo": "_START_ עד _END_ מתוך _TOTAL_ רשומות",
"sInfoEmpty": "0 עד 0 מתוך 0 רשומות",
"sInfoFiltered": "(מסונן מסך _MAX_ רשומות)",
"sInfoPostFix": "",
"sSearch": ":חפש", //"חפש:",
"sUrl": "",
"oPaginate": {
"sFirst": "ראשון",
"sPrevious": "קודם",
"sNext": "הבא",
"sLast": "אחרון"
}
},
"aaData": [data],
"aoColumns": [
{"mdata": "col1"},
{ "mdata": "col2" },
{ "mdata": "col3" },
{ "mdata": "col4" },
{ "mdata": "col5" }
]
});
});
}
[/code]
as we said the result is an empty table with [object object] on each column.
we realy could use some help.
thanks,
tae
i have been trying to implement your plugin.
some far very nice :)
we have just one major issue, we cannot seem to bind a json object to the dataTable.
we need to be able to get a json object independently from server side and then rebind it to the table.
we cannot seem to achieve this. in one of our attempts we are only able to see [object object] instead of the actual data.
here is what we did:
[code]
// this simulates the server response:
var data = '[{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"1","col2":"12","col3":"13","col4":"14","col5":"15"},{"col1":"4","col2":"42","col3":"43","col4":"44","col5":"45"}]';
data = $.parseJSON(data);
$(document).ready(function ()
{
$('#example').dataTable({
"bPaginate": true,
"sPaginationType": "full_numbers",
"oLanguage": {
"sUrl": "dataTables.hebrew.txt",
"sProcessing": "מעבד...",
"sLengthMenu": "הצג _MENU_ פריטים",
"sZeroRecords": "לא נמצאו רשומות מתאימות",
"sInfo": "_START_ עד _END_ מתוך _TOTAL_ רשומות",
"sInfoEmpty": "0 עד 0 מתוך 0 רשומות",
"sInfoFiltered": "(מסונן מסך _MAX_ רשומות)",
"sInfoPostFix": "",
"sSearch": ":חפש", //"חפש:",
"sUrl": "",
"oPaginate": {
"sFirst": "ראשון",
"sPrevious": "קודם",
"sNext": "הבא",
"sLast": "אחרון"
}
},
"aaData": [data],
"aoColumns": [
{"mdata": "col1"},
{ "mdata": "col2" },
{ "mdata": "col3" },
{ "mdata": "col4" },
{ "mdata": "col5" }
]
});
});
}
[/code]
as we said the result is an empty table with [object object] on each column.
we realy could use some help.
thanks,
tae
This discussion has been closed.