[Object object] rendering...

[Object object] rendering...

jmhall09jmhall09 Posts: 4Questions: 2Answers: 0
edited March 2015 in Free community support

I have a json call that is returning this: { gpin: "14557847740000", situsStreet: "1300 Regent University Dr", zipCode: "23464", squareFeet: [ { sqFt: 6600 }, { sqFt: 480 } ] },

In my datatable I am trying to return sqFt. I am referencing data: "sqaureFeet" and it is return the object text. I am very new to this. How do I go about displaying the sqFt rather than [object Object]?

My datatable looks something like this:

var oTable = $('#commercial').dataTable({
            responsive: true,
            "ajax": URL, 
            "columns": [{ "data": "gpin" }, { "data": "gpin" }, { "data": "situsStreet" }, { "data": "zipCode" }, { "data": "squareFeet" }], 
            "fnRowCallback": function( nRow, data, iDisplayIndex ) {
                //$('td:eq(0)', nRow).html('<img src="/_images/' + data.PictometryImages[0].ImageName + '"/>');
                $('td:eq(0)', nRow).html('<img src="/_images/default.jpg" class="home-image"/>');
                $('td:eq(1)', nRow).html('<a onClick="showDetails(' + data.gpin + ')">' + data.gpin + '</a>'); 
                return nRow;
            }, 
            "aaSorting": [[1,'asc']],
            "aoColumnDefs": [{ "bSortable": false, "sDefaultContent": "Edit", "aTargets": [ 0 ] }]
        });        

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    Answer ✓

    squareFeet is an array would you would need to use something like "data": "squareFeet[, ].sqFt".

    See columns.data for further details of the options of that parameter.

    Allan

  • jmhall09jmhall09 Posts: 4Questions: 2Answers: 0

    Thank you so much. Works great. I will get a handle on this one day. Much appreciated.

This discussion has been closed.