<?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>Erhan is typing... &#187; ExtJS</title>
	<atom:link href="http://erhanabay.com/category/extjs/feed/" rel="self" type="application/rss+xml" />
	<link>http://erhanabay.com</link>
	<description>WebDevelopment , PHP, Javascript, CakePHP, ExtJS</description>
	<lastBuildDate>Sat, 23 Jan 2010 15:15:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Ext.Direct for CakePHP</title>
		<link>http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/</link>
		<comments>http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 02:19:51 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=385</guid>
		<description><![CDATA[Finally, I completed the basic implementation of Ext.Direct server-side stack for CakePHP. You can clone a working copy from http://github.com/eabay/directcakephp. It is not that good but it works! http://www.extjs.com/forum/showthread.php?t=86501 Related Posts:CakePHP Helper for rakaz Combine Items Per Page Plugin for ExtJS


Related Posts:<ul><li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
<li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Finally, I completed the basic implementation of Ext.Direct server-side stack for CakePHP.</p>
<p>You can clone a working copy from <a href="http://github.com/eabay/directcakephp" onclick="pageTracker._trackPageview('/outgoing/github.com/eabay/directcakephp?referer=');">http://github.com/eabay/directcakephp</a>.</p>
<p>It is not that good but it works! <img src='http://erhanabay.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://www.extjs.com/forum/showthread.php?t=86501" onclick="pageTracker._trackPageview('/outgoing/www.extjs.com/forum/showthread.php?t=86501&amp;referer=');">http://www.extjs.com/forum/showthread.php?t=86501</a></p>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=385&type=feed" alt="" />

<p>Related Posts:<ul><li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
<li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top10 Hardware OC Yarışması</title>
		<link>http://erhanabay.com/2009/10/13/top10-hardware-oc-yarismasi/</link>
		<comments>http://erhanabay.com/2009/10/13/top10-hardware-oc-yarismasi/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 13:47:09 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=318</guid>
		<description><![CDATA[Eğer Türkiye sınırları içerisindeyseniz ve overclocking meraklısıysanız tatmin edici ödüllerin olduğu bu yarışmaya katılmanızı öneririm.]]></description>
			<content:encoded><![CDATA[<p><a href="http://ocyarisma.top10hardware.com/" onclick="pageTracker._trackPageview('/outgoing/ocyarisma.top10hardware.com/?referer=');"><img src="http://erhanabay.com/wp-content/uploads/2009/10/occontest.png" alt="occontest" title="occontest" width="600" height="406" class="aligncenter size-full wp-image-317" /></a></p>
<p>Eğer Türkiye sınırları içerisindeyseniz ve overclocking meraklısıysanız tatmin edici ödüllerin olduğu bu <a href="http://ocyarisma.top10hardware.com/" onclick="pageTracker._trackPageview('/outgoing/ocyarisma.top10hardware.com/?referer=');">yarışmaya</a> katılmanızı öneririm. <img src='http://erhanabay.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=318&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/10/13/top10-hardware-oc-yarismasi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Items Per Page Plugin for ExtJS</title>
		<link>http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/</link>
		<comments>http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 15:02:15 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=262</guid>
		<description><![CDATA[It is a plugin to change dynamically the number of items displayed in a grid. Plugin code: /** * ExtJS component to display number of items per page * * @copyright 2009 Erhan Abay * @author Erhan Abay * @version $Revision$ * @lastmodified $Date$ */ Ext.ux.PerPageField = Ext.extend(Object, { beforeText : '', afterText : 'items [...]]]></description>
			<content:encoded><![CDATA[<p>It is a plugin to change dynamically the number of items displayed in a grid.</p>
<p>Plugin code:</p>
<pre class="brush: jscript;">
/**
 * ExtJS component to display number of items per page
 *
 * @copyright       2009 Erhan Abay
 * @author          Erhan Abay
 * @version         $Revision$
 * @lastmodified    $Date$
 */
Ext.ux.PerPageField = Ext.extend(Object, {

	beforeText : '',
	afterText : 'items per page',

	constructor : function(config) {
		Ext.apply(this, config);
	},

	init : function(grid) {
		this.grid = grid;

		this.grid.on({
			render : function() {
				this.grid.bottomToolbar.add(['-', '-',
						this.beforeText, this.combo,
						this.afterText]);
			},
			scope : this
		});

		this.combo = new Ext.form.ComboBox({
			store : ['5', '10', '20', '50', '100', '200'],
			mode : 'local',
			triggerAction : 'all',
			width : 50,
			listClass : 'x-combo-list-small',
			maskRe : /^[0-9]$/,
			value : grid.bottomToolbar.pageSize,
			listeners : {
				'collapse' : function(f) {
					this.triggerEvent(f);
				},

				'specialkey' : function(f, e) {
					if (e.getKey() == e.ENTER) {
						this.triggerEvent(f);
					}
				},
				scope : this
			}
		});
	},

	triggerEvent : function(f) {
		var o = {
			start : 0
		};
		var v = parseInt(f.getRawValue());
		this.grid.store.baseParams = this.grid.store.baseParams || {};
		this.grid.store.baseParams['limit'] = v;
		this.grid.bottomToolbar.pageSize = v;
		this.grid.store.reload({
			params : o
		});
	}
});

Ext.preg('perpagefield', Ext.ux.PerPageField);
</pre>
<p>Usage:</p>
<pre class="brush: jscript;">
var grid = new Ext.grid.GridPanel({
...
    plugins: [{
        ptype: 'perpagefield',
        beforeText: '',
        afterText: ''
    }],
...
});&lt;/pre&gt;
</pre>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=262&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ext.Direct for ASP.NET MVC</title>
		<link>http://erhanabay.com/2009/07/01/ext-direct-for-asp-net-mvc/</link>
		<comments>http://erhanabay.com/2009/07/01/ext-direct-for-asp-net-mvc/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 19:17:46 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=268</guid>
		<description><![CDATA[Sorry, I forgot that I have a blog. Classic ASP was the last scripting language that I used from the universe of Microsoft. PHP is enough to make me happy and my clients. (Hey!, which client cares about the language of your choice? ) Anyway, I won&#8217;t make a comparison of languages. I am not [...]


Related Posts:<ul><li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
<li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Sorry, I forgot that I have a blog. <img src='http://erhanabay.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a href="http://en.wikipedia.org/wiki/Active_Server_Pages" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Active_Server_Pages?referer=');">Classic ASP</a> was the last scripting language that I used from the universe of Microsoft. PHP is enough to make me happy and my clients. (Hey!, which client cares about the language of your choice? <img src='http://erhanabay.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p>Anyway, I won&#8217;t make a comparison of languages. I am not that stupid. I just want to tell you something about how I am impressed with <a href="http://extjs.com/products/extjs/direct.php" onclick="pageTracker._trackPageview('/outgoing/extjs.com/products/extjs/direct.php?referer=');">Ext.Direct</a> and the <a href="http://extjs.com/forum/showthread.php?t=72245" onclick="pageTracker._trackPageview('/outgoing/extjs.com/forum/showthread.php?t=72245&amp;referer=');">server-side stack</a> for <a href="http://www.asp.net/mvc/" onclick="pageTracker._trackPageview('/outgoing/www.asp.net/mvc/?referer=');">ASP.NET MVC</a>.</p>
<p><a href="http://directwebremoting.org/" onclick="pageTracker._trackPageview('/outgoing/directwebremoting.org/?referer=');">DWR</a> is popular enough in Java world. They know a lot the concept of &#8220;remoting server-side methods to the client-side&#8221;. Ext.Direct has <a href="http://extjs.com/forum/showthread.php?t=67992" onclick="pageTracker._trackPageview('/outgoing/extjs.com/forum/showthread.php?t=67992&amp;referer=');">implementations</a> for several other languages and frameworks. Sadly, CakePHP is not in the list of supported frameworks but ASP.NET MVC has one of the powerful one.</p>
<p>You define couple of config values in web.config and that&#8217;s all! Just extend your controller from DirectController and use DirectResult typed methods to return your result to the browser. You can use several attributes for classes and methods to hide them in Ext.Direct remoting api object returned to the browser.</p>
<p>By the way, I was <span>curious about ASP.NET. I learned MVC pattern from CakePHP. C# and PHP have similar syntax. Those smooth out my </span><span> learning curve in ASP.NET MVC. We can discuss pros and cons of ASP.NET etc. but one thing is clear, Visual Studio. I am using Zend Studio and have tried several others but I have never met that quality of IDE before.</span></p>
<p>Finally, you are right. It is hard to follow. I was talking about ASP, PHP, then Ext.Direct and ASP.NET MVC came to the picture. Let&#8217;s say that this post is a sign of life. <img src='http://erhanabay.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>I have a lot to share with you, jQuery, Mootools, Zend Framework, Posh, gadget development, new released ExtJS 3.0, Moodle, PHP 5.3 release, and much more&#8230;</p>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=268&type=feed" alt="" />

<p>Related Posts:<ul><li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
<li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/07/01/ext-direct-for-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplifying Icon Management in Ext JS</title>
		<link>http://erhanabay.com/2009/02/12/simplifying-icon-management-in-ext-js/</link>
		<comments>http://erhanabay.com/2009/02/12/simplifying-icon-management-in-ext-js/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 02:40:14 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[icon]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=251</guid>
		<description><![CDATA[New version of Ext JS, 2.2.1, is announced and we are so happy, aren&#8217;t we? Another Ext JS news: Ext Conference 2009. I wish, I could attend. I hope, I am going to be there in the next conference&#8230; In this short tutorial, I am going to show you to simply the icon management in [...]


Related Posts:<ul><li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
<li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>New version of Ext JS, 2.2.1, is announced and we are so happy, aren&#8217;t we? <img src='http://erhanabay.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Another Ext JS news: <a href="http://extjs.com/conference/" onclick="pageTracker._trackPageview('/outgoing/extjs.com/conference/?referer=');">Ext Conference 2009</a>. I wish, I could attend. I hope, I am going to be there in the next conference&#8230;</p>
<p>In this short tutorial, I am going to show you to simply the icon management in Ext JS. It is not a complete solution. If you want to see a more professional one, see <a href="http://tdg-i.com/44/extuxtdgiiconmgr-a-utility-class-for-managing-icons-and-css" onclick="pageTracker._trackPageview('/outgoing/tdg-i.com/44/extuxtdgiiconmgr-a-utility-class-for-managing-icons-and-css?referer=');">Ext.ux.TDGi.iconMgr</a> from TDG innovations.</p>
<p>When you want to use icons in your Ext JS application you either have to use &#8220;icon&#8221; config option by giving path to your icon or &#8220;iconCls&#8221; by defining a new CSS class. The latter one is more prefferable way of doing it but it means that you need to define a CSS class for each of your icons. Let&#8217;s create a new function to make it easy!</p>
<pre class="brush: jscript;">
Ext.ux.Icon = function(icon){
  var path = 'img/icons/';
  if(!Ext.util.CSS.getRule('.icon-'+icon)){
    Ext.util.CSS.createStyleSheet('.icon-'+icon+' { background-image: url('path+icon+'.png) !important; }');
  }
  return 'icon-'+icon;
}
</pre>
<p>Change the value of &#8220;path&#8221; where your PNG icons are located. Don&#8217;t tell me you don&#8217;t hear the famous icon collection from <a href="http://www.famfamfam.com/lab/icons/silk/" onclick="pageTracker._trackPageview('/outgoing/www.famfamfam.com/lab/icons/silk/?referer=');">famfamfam</a>!</p>
<p>And call it like:</p>
<pre class="brush: jscript;">
...,
iconCls: Ext.ux.Icon('excel'),
...,
</pre>
<p>It is going to add a new CSS rule &#8220;icon-excel&#8221; with background-image &#8220;excel.png&#8221; and add it to the head of your page.</p>
<p>I can hear you say why you have to use PNG extension? You are right, you don&#8217;t have. Just modify Ext.ux.Icon by adding a second argument ,maybe, called as extension and pass the icon&#8217;s extension:</p>
<pre class="brush: jscript;">
Ext.ux.Icon = function(icon, extension){
  var path = 'img/icons/';
  if(!Ext.util.CSS.getRule('.icon-'+icon)){
    Ext.util.CSS.createStyleSheet('.icon-'+icon+' { background-image: url('path+icon+'.'+extension+') !important; }');
  }
  return 'icon-'+icon;
}
</pre>
<pre class="brush: jscript;">
...,
iconCls: Ext.ux.Icon('excel', 'png'),
...,
</pre>
<p>or by removing the extension part and passing the name of icon with its extension:</p>
<pre class="brush: jscript;">
Ext.ux.Icon = function(icon){
  var path = 'img/icons/';
  if(!Ext.util.CSS.getRule('.icon-'+icon)){
    Ext.util.CSS.createStyleSheet('.icon-'+icon+' { background-image: url('path+icon+') !important; }');
  }
  return 'icon-'+icon;
}
</pre>
<pre class="brush: jscript;">
...,
iconCls: Ext.ux.Icon('excel.png'),
...,
</pre>
<p>Don&#8217;t use Ext.ux.Icon if you are going to use hundreds of CSS rules because each class is defined in its own &#8220;style&#8221; tag and it can affect browser rendering performance.</p>
<p>It&#8217;s not important what you think, it&#8217;s important what you do&#8230; <img src='http://erhanabay.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=251&type=feed" alt="" />

<p>Related Posts:<ul><li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/19/cakephp-helper-for-rakaz-combine/' rel='bookmark' title='Permanent Link: CakePHP Helper for rakaz Combine'>CakePHP Helper for rakaz Combine</a></li>
<li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/02/12/simplifying-icon-management-in-ext-js/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamic Grid Panel for Ext JS</title>
		<link>http://erhanabay.com/2009/01/29/dynamic-grid-panel-for-ext-js/</link>
		<comments>http://erhanabay.com/2009/01/29/dynamic-grid-panel-for-ext-js/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 01:58:21 +0000</pubDate>
		<dc:creator>Erhan Abay</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[auto grid]]></category>
		<category><![CDATA[CRUD]]></category>
		<category><![CDATA[dynamic grid]]></category>

		<guid isPermaLink="false">http://erhanabay.com/?p=159</guid>
		<description><![CDATA[I am using Ext JS in my web application projects and I decided that it is time to give back to the community. If you are developing a CRUD application and using grids to display data from your database you should define similar column models, fields, readers, stores etc. for your grids. It is not [...]


Related Posts:<ul><li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I am using <a href="http://extjs.com" onclick="pageTracker._trackPageview('/outgoing/extjs.com?referer=');">Ext JS</a> in my web application projects and I decided that it is time to give back to the community.</p>
<p>If you are developing a <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Create_read_update_and_delete?referer=');">CRUD</a> application and using grids to display data from your database you should define similar column models, fields, readers, stores etc. for your grids. It is not a big concern if it is not the first time you do the same things or you have your own components not to repeat yourself. But what if your database table needs a change in its structure? Let me guess&#8230; You change field and column model definitions in your grids and doing the same again and again even there are small changes.</p>
<p>Here is a small Ext JS component that I wrote:</p>
<pre class="brush: jscript;">
Ext.ux.DynamicGridPanel = Ext.extend(Ext.grid.GridPanel, {

  initComponent: function(){
    /**
     * Default configuration options.
     *
     * You are free to change the values or add/remove options.
     * The important point is to define a data store with JsonReader
     * without configuration and columns with empty array. We are going
     * to setup our reader with the metaData information returned by the server.
     * See http://extjs.com/deploy/dev/docs/?class=Ext.data.JsonReader for more
     * information how to configure your JsonReader with metaData.
     *
     * A data store with remoteSort = true displays strange behaviours such as
     * not to display arrows when you sort the data and inconsistent ASC, DESC option.
     * Any suggestions are welcome
     */
    var config = {
      viewConfig: {forceFit: true},
      enableColLock: false,
      loadMask: true,
      border: false,
      stripeRows: true,
      ds: new Ext.data.Store({
		    url: this.storeUrl,
		    reader: new Ext.data.JsonReader()
		  }),
      columns: []
    };

    Ext.apply(this, config);
    Ext.apply(this.initialConfig, config);

    Ext.ux.DynamicGridPanel.superclass.initComponent.apply(this, arguments);
  },

  onRender: function(ct, position){
    this.colModel.defaultSortable = true;

    Ext.ux.DynamicGridPanel.superclass.onRender.call(this, ct, position);

    /**
     * Grid is not masked for the first data load.
     * We are masking it while store is loading data
     */
    this.el.mask('Loading...');
    this.store.on('load', function(){
      /**
       * Thats the magic! <img src='http://erhanabay.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
       *
       * JSON data returned from server has the column definitions
       */
      if(typeof(this.store.reader.jsonData.columns) === 'object') {
	      var columns = [];

	      /**
	       * Adding RowNumberer or setting selection model as CheckboxSelectionModel
	       * We need to add them before other columns to display first
	       */
	      if(this.rowNumberer) { columns.push(new Ext.grid.RowNumberer()); }
	      if(this.checkboxSelModel) { columns.push(new Ext.grid.CheckboxSelectionModel()); }

        Ext.each(this.store.reader.jsonData.columns, function(column){
          columns.push(column);
        });

	      /**
	       * Setting column model configuration
	       */
	      this.getColumnModel().setConfig(columns);
      }
      /**
       * Unmasking grid
       */
      this.el.unmask();
    }, this);
    /**
     * And finally load the data from server!
     */
    this.store.load();
  }
});
</pre>
<p>How to use it?</p>
<pre class="brush: jscript;">
new Ext.ux.DynamicGridPanel({
  id: 'my-grid',
  storeUrl: 'server/url/address/',
  rowNumberer: true,
  checkboxSelModel: true,
  sm: new Ext.grid.CheckboxSelectionModel(),
});
</pre>
<p>And here is the JSON which should be returned from server to dynamically create column and field definitions:</p>
<pre class="brush: jscript;">
{
    &quot;metaData&quot;: {
        &quot;totalProperty&quot;: &quot;total&quot;,
        &quot;root&quot;: &quot;records&quot;,
        &quot;id&quot;: &quot;id&quot;,
        &quot;fields&quot;: [
            {
                &quot;name&quot;: &quot;id&quot;,
                &quot;type&quot;: &quot;int&quot;
            },
            {
                &quot;name&quot;: &quot;name&quot;,
                &quot;type&quot;: &quot;string&quot;
            }
        ]
    },
    &quot;success&quot;: true,
    &quot;total&quot;: 50,
    &quot;records&quot;: [
        {
            &quot;id&quot;: &quot;1&quot;,
            &quot;name&quot;: &quot;AAA&quot;
        },
        {
            &quot;id&quot;: &quot;2&quot;,
            &quot;name&quot;: &quot;BBB&quot;
        }
    ],
    &quot;columns&quot;: [
        {
            &quot;header&quot;: &quot;#&quot;,
            &quot;dataIndex&quot;: &quot;id&quot;
        },
        {
            &quot;header&quot;: &quot;User&quot;,
            &quot;dataIndex&quot;: &quot;name&quot;
        }
    ]
}
</pre>
<p>The code itself is somewhat self-explanatory but for newbie users <a href="http://extjs.com/learn/" onclick="pageTracker._trackPageview('/outgoing/extjs.com/learn/?referer=');">learning center</a> is a good start to understand how to extend Ext JS or simply understand how the framework works.</p>
<p>Suggestions and comments are welcome&#8230;</p>
<img src="http://erhanabay.com/?ak_action=api_record_view&id=159&type=feed" alt="" />

<p>Related Posts:<ul><li><a href='http://erhanabay.com/2009/10/10/items-per-page-plugin-for-extjs/' rel='bookmark' title='Permanent Link: Items Per Page Plugin for ExtJS'>Items Per Page Plugin for ExtJS</a></li>
<li><a href='http://erhanabay.com/2009/11/28/ext-direct-for-cakephp/' rel='bookmark' title='Permanent Link: Ext.Direct for CakePHP'>Ext.Direct for CakePHP</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://erhanabay.com/2009/01/29/dynamic-grid-panel-for-ext-js/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>
