Skip to main content

Posts

Showing posts from June, 2013

Generate JSON in Salesforce

I explore about JSON for generating pie chart in the site.I try this simple one, with hardcoded data. Requirement: 1)Apex Controller to prepare the data 2)Visual force page to display the data in JSON 1) Apex controller public class PieController { public String jsonString { get ; set ;} //Constructor public PieController () { jsonString = prepareData (); } //Temp Method to prepare the Data private String prepareData () { List & lt ; CompanyDetail & gt ; dtlObj = new List & lt ; CompanyDetail & gt ;(); CompanyDetail c1 = new CompanyDetail ( '1' , ' Samson ' , 30 ); CompanyDetail c2 = new CompanyDetail ( '2' , ' Targus ' , 35 ); CompanyDetail c3 = new CompanyDetail ( '3' , ' Swan ' , 60 ); CompanyDetail c4 = new CompanyDetail ( '4' , ' Filla ' , 30 ); dtlObj

Using SyntaxHighlighter

Update:Sept 04 2015 (I m using hilite.me) Notice how cool my code format here.Well I just install SyntaxHighlighter into this blog. Let see what type of syntax do I get Define in pre class 1) brush:html <pre class= "brush:html" > <!--This is my html sample, in the pre class , I choose html--> <pre class= "brush:html" > My html code in here </pre> </pre> 2)brush:sql <pre class= "brush:sql" > SELECT columnName FROM tableName </pre> I refer to this : 1) http://mlawire.blogspot.com/2009/07/blogger-syntax-highlighting.html 2) http://alexgorbatchev.com/SyntaxHighlighter/ Have a nice weekend