Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: Adding non-model columns to json bound table

$
0
0

One potential solution can be :

Dont bind table directly to the service. You can generate a custom JSON with the extra calculated field and bind it to the table.

Another potential solution can be :

Add one calculated field to your service in JSON format.

 

// CODE SAMPLE STARTS HERE

var service = {};

service.persons = [{name:"Amol", age:"31"}, {name:"Tom", age:"50"}];

 

/* at this point :

service = {"persons":[{"name":"Amol","age":"31"},{"name":"Tom","age":"50"}]}

can be checked with :

console.log(JSON.stringify(service));

*/

 

service.persons[0].city = "London";

service.persons[1].city = "Berlin";

 

/* at this point

service = {"persons":[{"name":"Amol","age":"31","city":"London"},{"name":"Tom","age":"50","city":"Berlin"}]}

can be checked with :

console.log(JSON.stringify(service));

*/

 

// CODE SAMPLE ENDS HERE


So you can see that you can dynamically generate a JSON service and add on fields to it at run time or add fields to an existing JSON service depending on your specific case.


For more information, refer http://www.json.org/js.html

I hope this helps !


Cheers,

Amol G.


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>