<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Dynamic Sencha Touch Forms : Part 2 : Dynamically loading Select Fields based on previously selected values</title>
	<atom:link href="http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/</link>
	<description></description>
	<lastBuildDate>Fri, 17 May 2013 05:53:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
	<item>
		<title>By: Brian</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-4117</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 02 Feb 2012 14:09:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-4117</guid>
		<description><![CDATA[Additionally I added the below methods to the initComponent: function() after  		this.onRegionChange(this.items.get(0), 1);
&quot;
this.onRegionChange(this.items.get(0), 1);
this.items.get(1).on({
	change: this.onCountryChange,
	scope: this
});
&quot;
This ensures that every time you change a country the cities are updated.
Great tutorial and great support!!!]]></description>
		<content:encoded><![CDATA[<p>Additionally I added the below methods to the initComponent: function() after  		this.onRegionChange(this.items.get(0), 1);</p>
<p>&#8221;<br />
this.onRegionChange(this.items.get(0), 1);</p>
<p>this.items.get(1).on({<br />
	change: this.onCountryChange,<br />
	scope: this<br />
});<br />
&#8221;</p>
<p>This ensures that every time you change a country the cities are updated. </p>
<p>Great tutorial and great support!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-4114</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Thu, 02 Feb 2012 12:41:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-4114</guid>
		<description><![CDATA[I added to the
&quot;if(firstCountry){countrySelectField.setValue(firstCountry.data.CountryID);...}&quot;:
&quot;
this.items.get(0).on({
		change: this.onCountryChange,
		scope: this
});
this.onCountryChange(this.items.get(0), 1);
&quot;
And it works! Thanks!!!]]></description>
		<content:encoded><![CDATA[<p>I added to the<br />
&#8220;if(firstCountry){countrySelectField.setValue(firstCountry.data.CountryID);&#8230;}&#8221;:</p>
<p>&#8221;<br />
this.items.get(0).on({<br />
		change: this.onCountryChange,<br />
		scope: this<br />
});</p>
<p>this.onCountryChange(this.items.get(0), 1);<br />
&#8221;	</p>
<p>And it works! Thanks!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-3980</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Mon, 30 Jan 2012 13:57:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-3980</guid>
		<description><![CDATA[You should put the Cities filter in the change event handler function of the second select field (the Country field in your case I think) so that when a value is chosen the City field is filtered.
I would recommend moving the change event binding you are doing at the start of your onRegionChange method to your initComponent method as this will bind the onCountryChange method to the change event everytime the region changes and so might give you some weird results.
Cheers
Stuart]]></description>
		<content:encoded><![CDATA[<p>You should put the Cities filter in the change event handler function of the second select field (the Country field in your case I think) so that when a value is chosen the City field is filtered.</p>
<p>I would recommend moving the change event binding you are doing at the start of your onRegionChange method to your initComponent method as this will bind the onCountryChange method to the change event everytime the region changes and so might give you some weird results.</p>
<p>Cheers<br />
Stuart</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-3976</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Mon, 30 Jan 2012 12:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-3976</guid>
		<description><![CDATA[I have begun to add the suggestions you made. In this, I created a Ext.regModel(&#039;Region&#039;...), created a regionStore, added a Region &#039;selectfield&#039; to the beginning of the Ext.apply(...items...), and created an onRegionChange method:
onRegionChange: function(selectField, value){
	this.items.get(0).on({
		change: this.onCountryChange,
		scope: this,
	});
	var countrySelectField = this.items.get(1);
	countrySelectField.store.clearFilter();
	countrySelectField.store.filter(&#039;RegionID&#039;, value);
	var firstCountry = countrySelectField.store.getAt(0);
	if(firstCountry){
		countrySelectField.setValue(firstCountry.data.CountryID);
	} else {
		countrySelectField.setValue(&#039;&#039;);
	}
}
Currently only the first items in Ext.apply(...items...) filters the second. Currently changing &#039;Region&#039; changes &#039;Country&#039;, while the &#039;City&#039; drop down list displays all of the cities.
How and where should I fire the filter on the cities?
Any suggestions would be appreciated!!!]]></description>
		<content:encoded><![CDATA[<p>I have begun to add the suggestions you made. In this, I created a Ext.regModel(&#8216;Region&#8217;&#8230;), created a regionStore, added a Region &#8216;selectfield&#8217; to the beginning of the Ext.apply(&#8230;items&#8230;), and created an onRegionChange method:</p>
<p>onRegionChange: function(selectField, value){<br />
	this.items.get(0).on({<br />
		change: this.onCountryChange,<br />
		scope: this,<br />
	});</p>
<p>	var countrySelectField = this.items.get(1);</p>
<p>	countrySelectField.store.clearFilter(); </p>
<p>	countrySelectField.store.filter(&#8216;RegionID&#8217;, value);  </p>
<p>	var firstCountry = countrySelectField.store.getAt(0); </p>
<p>	if(firstCountry){<br />
		countrySelectField.setValue(firstCountry.data.CountryID);<br />
	} else {<br />
		countrySelectField.setValue(&#8221;);<br />
	}<br />
}</p>
<p>Currently only the first items in Ext.apply(&#8230;items&#8230;) filters the second. Currently changing &#8216;Region&#8217; changes &#8216;Country&#8217;, while the &#8216;City&#8217; drop down list displays all of the cities. </p>
<p>How and where should I fire the filter on the cities? </p>
<p>Any suggestions would be appreciated!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-3876</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Fri, 27 Jan 2012 15:18:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-3876</guid>
		<description><![CDATA[You can add another field in the chain by first adding the select field. Then add a new method called onRegionChange and attach it to the new field&#039;s change event. It&#039;s then just a case of duplicating the logic in the example method (onCountryChange) but point it to the next selectfield.
The process will look a little like this:
&lt;strong&gt;Country Select Field&lt;/strong&gt; -&gt; &lt;em&gt;&lt;user selects item&gt;&lt;/user&gt;&lt;/em&gt; -&gt; &lt;strong&gt;onCountryChange&lt;/strong&gt; fires where we filter Region Select Field based on selection (potentially resetting the City selection)
&lt;strong&gt;Region Select Field&lt;/strong&gt; -&gt; &lt;em&gt;&lt;user selects item (from filtered list after step 1)&gt;&lt;/user&gt;&lt;/em&gt; -&gt; &lt;strong&gt;onRegionChange&lt;/strong&gt; fires where we filter City Select Field based on region selection.
Hope that makes sense!
Stuart
.]]></description>
		<content:encoded><![CDATA[<p>You can add another field in the chain by first adding the select field. Then add a new method called onRegionChange and attach it to the new field&#8217;s change event. It&#8217;s then just a case of duplicating the logic in the example method (onCountryChange) but point it to the next selectfield.</p>
<p>The process will look a little like this:</p>
<p><strong>Country Select Field</strong> -> <em><user selects item></user></em> -> <strong>onCountryChange</strong> fires where we filter Region Select Field based on selection (potentially resetting the City selection)<br />
<strong>Region Select Field</strong> -> <em><user selects item (from filtered list after step 1)></user></em> -> <strong>onRegionChange</strong> fires where we filter City Select Field based on region selection.</p>
<p>Hope that makes sense!<br />
Stuart<br />
.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-3875</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 27 Jan 2012 14:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-3875</guid>
		<description><![CDATA[How would you add another layer... with &quot;Region&quot; for instance?]]></description>
		<content:encoded><![CDATA[<p>How would you add another layer&#8230; with &#8220;Region&#8221; for instance?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-1544</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 07 Dec 2011 20:41:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-1544</guid>
		<description><![CDATA[nevermind... I got! thanks you!]]></description>
		<content:encoded><![CDATA[<p>nevermind&#8230; I got! thanks you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-1541</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 07 Dec 2011 19:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-1541</guid>
		<description><![CDATA[Actually I&#039;m trying to do something a bit different then what you are doing here.. I have a segmented button with 4 items, each of these items have a tap handler.
My problem is I need the scope (this) in this.periodChanged because it is calling another method... I tried replacing handler: this.periodChanged with addListener: { tap: this.periodChanged, scope: this } but nothing happens when i tap the button...
{
            xtype: &#039;segmentedbutton&#039;,
            allowDepress: true,
            items: [{ text: &#039;Day&#039;, handler: this.periodChanged, pressed: true },
                    { text: &#039;Week&#039;, handler: this.periodChanged },
                    { text: &#039;Month&#039;, handler: this.periodChanged },
                    { text: &#039;Year&#039;, handler: this.periodChanged }
            ]
        };
Thank you]]></description>
		<content:encoded><![CDATA[<p>Actually I&#8217;m trying to do something a bit different then what you are doing here.. I have a segmented button with 4 items, each of these items have a tap handler. </p>
<p>My problem is I need the scope (this) in this.periodChanged because it is calling another method&#8230; I tried replacing handler: this.periodChanged with addListener: { tap: this.periodChanged, scope: this } but nothing happens when i tap the button&#8230;</p>
<p>{<br />
            xtype: &#8216;segmentedbutton&#8217;,<br />
            allowDepress: true,<br />
            items: [{ text: 'Day', handler: this.periodChanged, pressed: true },<br />
                    { text: 'Week', handler: this.periodChanged },<br />
                    { text: 'Month', handler: this.periodChanged },<br />
                    { text: 'Year', handler: this.periodChanged }<br />
            ]<br />
        };</p>
<p>Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-1540</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 07 Dec 2011 19:30:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-1540</guid>
		<description><![CDATA[Ahhh... :P]]></description>
		<content:encoded><![CDATA[<p>Ahhh&#8230; <img src='http://www.swarmonline.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart</title>
		<link>http://www.swarmonline.com/2011/05/dynamic-sencha-touch-forms-part-2-dynamically-loading-select-fields-based-on-previously-selected-values/#comment-1539</link>
		<dc:creator>Stuart</dc:creator>
		<pubDate>Wed, 07 Dec 2011 19:10:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.swarmonline.com/?p=1191#comment-1539</guid>
		<description><![CDATA[The dockedItems property is an array and so doesn&#039;t have a &#039;get&#039; method. You should access its elements using the usual array syntax (this.dockedItems[0]).]]></description>
		<content:encoded><![CDATA[<p>The dockedItems property is an array and so doesn&#8217;t have a &#8216;get&#8217; method. You should access its elements using the usual array syntax (this.dockedItems[0]).</p>
]]></content:encoded>
	</item>
</channel>
</rss>
