<?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>Ed Spencer &#187; post</title>
	<atom:link href="http://edspencer.net/tag/post/feed" rel="self" type="application/rss+xml" />
	<link>http://edspencer.net</link>
	<description>A Sencha Architect</description>
	<lastBuildDate>Sat, 11 Feb 2012 09:20:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Force Ext.data.Store to use GET</title>
		<link>http://edspencer.net/2009/02/force-extdatastore-to-use-get.html</link>
		<comments>http://edspencer.net/2009/02/force-extdatastore-to-use-get.html#comments</comments>
		<pubDate>Wed, 11 Feb 2009 15:23:00 +0000</pubDate>
		<dc:creator>Ed Spencer</dc:creator>
				<category><![CDATA[Examples]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[get]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[post]]></category>
		<category><![CDATA[store]]></category>

		<guid isPermaLink="false">http://192.168.2.15/Projects/wordpress/?p=25</guid>
		<description><![CDATA[<p>Say you have a simple Ext store:</p>
<pre class="brush: jscript;">
var myStore = new Ext.data.Store({
  url:    '/widgets.json',
  reader: someReader
});
</pre>
<p>Which you put in a grid, along with a paging toolbar:</p>
<pre class="brush: jscript;">
var myGrid = new Ext.grid.GridPanel({
  store:   myStore,
  columns: [.....],
  bbar:    new Ext.PagingToolbar({
    store: myStore
  })
  ... etc ...
});
</pre>
<p>Your grid loads up and the store performs a GET request to /widgets.json, which returns your widgets along with a total (<a href="http://extjs.com/deploy/dev/examples/grid/paging.html">see an example</a>).</p>
<p>Awesome, but now we click one of the paging buttons on the PagingToolbar and we have a problem &#8211; our request has turned into POST /widgets.json, with &#8220;start=20&#8243; and &#8220;limit=20&#8243; as POST params.</p>
<p>Now we don&#8217;t really want that &#8211; we&#8217;re not POSTing any data to the server after all, we&#8217;re just trying to GET some.  If you&#8217;re using a nice RESTful API on your server side this may cause you a real problem, as POST /widgets will likely be taken as an attempt to create a new Widget.</p>
<p>Luckily, as with most things the solution is simple if you know how.  An <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.Store">Ext.data.Store</a> delegates loading its data off to an <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.DataProxy">Ext.data.DataProxy</a> subclass.  By default your store will create an <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.HttpProxy">Ext.data.HttpProxy</a> using the url: &#8216;/widgets.json&#8217; you passed in your store config.  To make sure your stores are always requesting data using GET, just provide a proxy like this:</p>
<pre class="brush: jscript;">
var myStore = new Ext.data.Store({
  proxy: new Ext.data.HttpProxy({
    url:    '/widgets.json',
    method: 'GET'
  }),
  reader: someReader
});
</pre>
]]></description>
			<content:encoded><![CDATA[<p>Say you have a simple Ext store:</p>
<pre class="brush: jscript;">
var myStore = new Ext.data.Store({
  url:    '/widgets.json',
  reader: someReader
});
</pre>
<p>Which you put in a grid, along with a paging toolbar:</p>
<pre class="brush: jscript;">
var myGrid = new Ext.grid.GridPanel({
  store:   myStore,
  columns: [.....],
  bbar:    new Ext.PagingToolbar({
    store: myStore
  })
  ... etc ...
});
</pre>
<p>Your grid loads up and the store performs a GET request to /widgets.json, which returns your widgets along with a total (<a href="http://extjs.com/deploy/dev/examples/grid/paging.html">see an example</a>).</p>
<p>Awesome, but now we click one of the paging buttons on the PagingToolbar and we have a problem &#8211; our request has turned into POST /widgets.json, with &#8220;start=20&#8243; and &#8220;limit=20&#8243; as POST params.</p>
<p>Now we don&#8217;t really want that &#8211; we&#8217;re not POSTing any data to the server after all, we&#8217;re just trying to GET some.  If you&#8217;re using a nice RESTful API on your server side this may cause you a real problem, as POST /widgets will likely be taken as an attempt to create a new Widget.</p>
<p>Luckily, as with most things the solution is simple if you know how.  An <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.Store">Ext.data.Store</a> delegates loading its data off to an <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.DataProxy">Ext.data.DataProxy</a> subclass.  By default your store will create an <a href="http://extjs.com/deploy/dev/docs/?class=Ext.data.HttpProxy">Ext.data.HttpProxy</a> using the url: &#8216;/widgets.json&#8217; you passed in your store config.  To make sure your stores are always requesting data using GET, just provide a proxy like this:</p>
<pre class="brush: jscript;">
var myStore = new Ext.data.Store({
  proxy: new Ext.data.HttpProxy({
    url:    '/widgets.json',
    method: 'GET'
  }),
  reader: someReader
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://edspencer.net/2009/02/force-extdatastore-to-use-get.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

