Quantcast
Viewing all articles
Browse latest Browse all 82152

Remote REST (JSON) Invocation. Stuck @ Processing...

I downloaded the trial version of DataTables Editor hoping to see if it would make my life easier; but so far not. I have a bunch of REST services, that are hosted in a different domain. Using the Editor REST example, I initialized the table as follows,

<script type='text/javascript'>
    	var editor; // use a global for the submit and return data rendering in the examples
 
		$(document).ready(function() {
		    editor = new $.fn.dataTable.Editor( {
		        "ajaxUrl": {
		            "create":        "POST http://localhost:9081/xxx/api/resource/accounts",
		            "edit":      "PUT http://localhost:9081/xxx/api/resource/accounts/_id_",
		            "remove": "DELETE http://localhost:9081/xxx/api/resource/accounts/_id_"
		        },
		        "domTable": "#accountsTable",
		        "fields": [
                    {
                     "label": "Alernative Name : ",
                     "name": "acctaltname"
                    },
                    {
                     "label": "Business Unit :",
                     "name": "acctbucode"
                    },
                    {
                         "label": "Coverage Type :",
                         "name": "acctcvrgtypecode"
                    },
                    {
                         "label": "Sector :",
                         "name": "acctcvrgsctrcode"
                    },
                    {
                         "label": "Industry :",
                         "name": "acctcvrgindcodes"
                    },
                    {
                         "label": "Coverage ID :",
                         "name": "acctcvrgidcode"
                    },
                    {
                         "label": "Client ID :",
                         "name": "acctclientids"
                    },		
					{
                     "label": "IMT :",
                     "name": "acctimtcode"
                    },
					{
                         "label": "Legacy Client ID :",
                         "name": "acctlegcclientids"
                    },			
					{
                    "label": "Client Name :",
                    "name": "acctname"
                    },
                    {
                         "label": "Domestic Buying Group ID :",
                         "name": "acctdombuygrps"
                    },
                    {
                         "label": "Notes :",
                         "name": "acctnote"
                    }
           ]
		    } );
		 
		    $('#accountsTable').dataTable( {
		        "sDom": "Tfrtip",
		        "sAjaxSource": "http://localhost:9081/xxx/api/resource/accounts",
		        "bProcessing": true,
		        "bServerSide": true,
        		"bLengthChange": true,
		        "aoColumns": [
		            { "mData": "acctname" },
		            { "mData": "acctimtcode" },
		            { "mData": "acctbucode" },
		            { "mData": "acctcvrgsctrcode", "sClass": "center" },
		            { "mData": "acctcvrgindcodes", "sClass": "center" }
		        ],		        
		        "oTableTools": {
		            "sRowSelect": "multi",
		            "aButtons": [
		                { "sExtends": "editor_create", "editor": editor },
		                { "sExtends": "editor_edit",   "editor": editor },
		                { "sExtends": "editor_remove", "editor": editor }
		            ]
		        }
		    } );
		} );
  	</script>  	

The table does not populate and its stuck with a "Processing...." message. The JSON response that comes back from the REST call is shown below and is valid per JSONLint. What am I missing here?

{
    "aaData": [
        {
            "accountid": 9,
            "acctaltname": "Includes NSTAR",
            "acctbucode": "Northeast",
            "acctclientids": "c111",
            "acctcvrgidcode": "East",
            "acctcvrgindcodes": "Utility and Energy Services",
            "acctcvrgsctrcode": "Communications",
            "acctcvrgsegmtcode": "Invest",
            "acctcvrgtypecode": "Aligned",
            "acctdombuygrps": "2",
            "acctimtcode": "East",
            "acctlegcclientids": "11111",
            "acctname": "Northeast Utilities",
            "acctnote": "",
            "accttimestamp": 0,
            "employee": [
                {
                    "armapid": 9,
                    "armaptimestamp": 0,
                    "arrolecode": "Consultant",
                    "employeeid": 26,
                    "contact": {
                        "employeeid": 26,
                        "eminetid": "homer@simpson.com",
                        "emname": "Homer Simpson",
                        "emnotesid": "Homer/HS/US",
                        "emtimestamp": -62135748000000
                    }
                }
            ]
        }
    ]
}

Viewing all articles
Browse latest Browse all 82152

Trending Articles