Display 'data table' data in angularjs

14 views
Skip to first unread message

honey asin

unread,
Dec 24, 2017, 11:12:27 PM12/24/17
to Angular and AngularJS discussion
Hi,
 I am working in angularjs and I am making a call to WCF, which is further making a call to 'Business Layer' which is returning 'DataTable' data to WCF service. Now WCF needs to return the DataTable to Client side(.html page), so I am currently converting the DataTable to JSON string format and returning it to UI. At UI side, while making a Javascript object from the JSON string using angular.fromJson() function the sequence of column names gets changed and Javascript arrays are being made in alphabetical order. I do not want data to be alphabetically sorted when Javascript object is made. 

So my query is as below:
1) How to prevent angular.fromJson() function from sorting data in JSON string in alphabetical order when it prepared JS Array from JSON string?

2) Is converting DataTable data to JSON string a good approach?; or I should use some other data format.

This is the code snippet I am using:
{
var dimensionID = dimensionId;
var dataobj = JSON.stringify({ "dimensionId": 196 });
var response = commonservice.post(dataobj, 'ViewDimensionDetails');/
ShowLoader();
response.then(function (result) {
// result.data is JSON string returned by WCF
$scope.data = angular.fromJson(result.data);
}

Thank You
Honey Asin
Reply all
Reply to author
Forward
0 new messages