<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>joe-ferraro.com &#187; force.com sites</title>
	<atom:link href="http://joe-ferraro.com/tag/forcecom-sites/feed/" rel="self" type="application/rss+xml" />
	<link>http://joe-ferraro.com</link>
	<description>adless since 2008</description>
	<lastBuildDate>Thu, 24 Mar 2011 22:22:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>extjs &amp; visualforce</title>
		<link>http://joe-ferraro.com/2009/04/extjs-visualforce/</link>
		<comments>http://joe-ferraro.com/2009/04/extjs-visualforce/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 15:20:59 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[force.com sites]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=64</guid>
		<description><![CDATA[
I&#8217;m interested to hear how people are utilizing extjs in their visualforce pages.  I&#8217;ve found it very helpful to use Apex to generate the store on the server side, then pass it along to the Visualforce page via a hidden input to be handled on the client side (rather than use the apex:repeat tags).
Note: [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m interested to hear how people are utilizing extjs in their visualforce pages.  I&#8217;ve found it very helpful to use Apex to generate the store on the server side, then pass it along to the Visualforce page via a hidden input to be handled on the client side (rather than use the apex:repeat tags).</p>
<p>Note: once again, the grid below is a live Visualforce page from my developer Force.com site embedded into this post
</p>
<div>
 <IFRAME src="http://crmmanager-developer-edition.na6.force.com/test/ExtJs_Grid" height="400" width="650" frameborder="0" scrolling="no" ></IFRAME>
</div>
<pre name="code" class="java">

public class Grid_Controller {
	public string store {get;set;}
	public list&lt;QueueItem&gt; queueitems {get;set;}
	string userId = UserInfo.getUserId();

	public Grid_Controller() {
		queueitems = new queueitem[]{};
		for (Custom_Process_Instance__c cpi : [Select Owner.Name, Opportunity__r.Name, Opportunity__r.Id, (Select Id From Custom_Process_Instance_Step__r where Status__c != &#039;Completed&#039; AND Status__c = &#039;Pending&#039; limit 1), Percent_Complete__c, Process_Age__c from Custom_Process_Instance__c where Status__c = &#039;Pending&#039; AND Opportunity__c != null and IsDeleted = false order by CreatedDate asc]) {
            		QueueItem qi = new QueueItem(cpi);
            		queueitems.add(qi);
		}        

		string myDataString = &#039;var myData = [ &#039;;
		for(queueitem q : this.queueitems) {
			string showIcon = &#039;&#039;;
			if (q.ProcessInstance.Custom_Process_Instance_Step__r.size() == 1)
        			showIcon = &#039;yes&#039;;

			string oppId = q.ProcessInstance.Opportunity__c;
			string oppName = q.ProcessInstance.Opportunity__r.Name;
			string launchedby = q.ProcessInstance.Owner.Name;
			double percent = q.ProcessInstance.Percent_Complete__c;
			double ageInMinutes = q.ProcessInstance.Process_Age__c;

			if (q.ProcessInstance.Opportunity__r.Name != null)
				oppName = string.escapeSingleQuotes(q.ProcessInstance.Opportunity__r.Name);
			if (q.ProcessInstance.Owner.Name != null)
				launchedBy = string.escapeSingleQuotes(q.ProcessInstance.Owner.Name);

			myDataString += &#039;[\&#039;&#039;+showIcon+&#039;\&#039;,\&#039;&#039;+oppName+&#039;\&#039;, \&#039;&#039;+oppId+&#039;\&#039;,\&#039;&#039;+launchedBy+&#039;\&#039;,\&#039;&#039;+percent+&#039;\&#039;,\&#039;&#039;+ageInMinutes+&#039;\&#039;],&#039;;
		}

		myDataString += &#039;];&#039;;
		myDataString = myDataString.replace(&#039;,];&#039;, &#039;];&#039;);
		this.store = myDataString;
	}

	public class QueueItem {
		public Custom_Process_Instance__c ProcessInstance {get;set;}
		public QueueItem(Custom_Process_Instance__c cpi) {
			this.ProcessInstance = cpi;
		}
	}
}
</pre>
<pre name="code" class="java">

&lt;script type=&quot;text/javascript&quot;&gt;
	var myDataString = document.getElementById(&#039;{!$Component.myForm.dataStore}&#039;).value;
&lt;/script&gt;
</pre>
<pre name="code" class="java">

&lt;apex:form id=&quot;myForm&quot;&gt;
	&lt;apex:inputHidden value=&quot;{!store}&quot; id=&quot;dataStore&quot;/&gt;
&lt;/apex:form&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/04/extjs-visualforce/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>wrapper class and force.com sites</title>
		<link>http://joe-ferraro.com/2008/11/wrapper-class-and-forcecom-sites/</link>
		<comments>http://joe-ferraro.com/2008/11/wrapper-class-and-forcecom-sites/#comments</comments>
		<pubDate>Thu, 13 Nov 2008 20:17:05 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[apex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>
		<category><![CDATA[Force.com]]></category>
		<category><![CDATA[force.com sites]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=49</guid>
		<description><![CDATA[Force.com Sites was announced last week at Dreamforce ‘08 and what a game changing announcement it was.  Here’s my foray into Sites development, with nifty sample code...]]></description>
			<content:encoded><![CDATA[<p>Force.com Sites was announced last week at Dreamforce &#8216;08 and what a game changing announcement it was.  Here&#8217;s my foray into Sites development, with nifty sample code (please note the table of opportunity data below is a live Salesforce.com Visualforce page from my development environment embedded into this post):</p>
<div>
 <IFRAME src="http://crmmanager-developer-edition.na6.force.com/test" height="500" width="500" ></IFRAME>
</div>
<div>
<b>Controller</b></p>
<pre name="code" class="java">

public class OpportunityList_Controller {
	public class MyOpportunity {
	    Opportunity o;
	    public MyOpportunity(Opportunity opp) { o = opp; }
	    public Opportunity getOpportunity(){ return o; }

	    public String getColor()  {
		    if (o.Probability &lt; 25) return &#039;#2A73F0&#039;;
		    else if (o.Probability &gt;= 25 &amp;amp;amp;&amp;amp;amp; o.Probability &lt;= 75) return &#039;#E0B60D&#039;;
		    else if (o.Probability &gt; 75) return &#039;#FF0000&#039;;
		    else return &#039;#000000&#039;;
	    }
    }

    public List&lt;MyOpportunity&gt; results = new List&lt;MyOpportunity&gt;{};

	public List&lt;MyOpportunity&gt; getOpportunities() {
		results.clear();
        for (Opportunity o : [Select Id, Name, StageName, Closedate, Probability
From Opportunity where StageName != &#039;Closed Won&#039; order by Name limit 20]) {
        	results.add(new MyOpportunity(o));
        }
		return results;
    }
}
</pre>
</div>
<p></p>
<div>
<b>Visualforce Page</b></p>
<pre name="code" class="java">

&lt;apex:page controller=&quot;OpportunityList_Controller&quot;
tabStyle=&quot;Opportunity&quot; showHeader=&quot;false&quot; sidebar=&quot;false&quot; &gt;
	&lt;apex:form &gt;
		&lt;apex:pageBlock title=&quot;&quot; id=&quot;pageBlock&quot;&gt;
			&lt;apex:pageMessages &gt;&lt;/apex:pageMessages&gt;
			&lt;apex:pageBlockTable value=&quot;{!opportunities}&quot; var=&quot;o&quot;
rendered=&quot;{!NOT(ISNULL(opportunities))}&quot;&gt;
				&lt;apex:column &gt;
					&lt;apex:facet name=&quot;header&quot;&gt;Opportunity Name&lt;/apex:facet&gt;
					&lt;div style=&quot;color:{!o.color};font-weight:bold;text-decoration:underline;cursor:hand;cursor:pointer;&quot;&gt;
					{!o.Opportunity.Name}
					&lt;/div&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!o.Opportunity.Probability}&quot;&gt;&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!o.Opportunity.StageName}&quot;&gt;&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!o.Opportunity.CloseDate}&quot;&gt;&lt;/apex:column&gt;
			&lt;/apex:pageBlockTable&gt;
		&lt;/apex:pageBlock&gt;
	&lt;/apex:form&gt;
&lt;/apex:page&gt;
</pre>
</div>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2008/11/wrapper-class-and-forcecom-sites/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

