<?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>Superdit.com &#187; grid</title>
	<atom:link href="http://superdit.com/tag/grid/feed/" rel="self" type="application/rss+xml" />
	<link>http://superdit.com</link>
	<description>blogging, design, tech, and web</description>
	<lastBuildDate>Sat, 31 Mar 2012 20:40:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>27 CSS Grid System &amp; Generator To Build Web Layout</title>
		<link>http://superdit.com/2011/08/24/27-css-grid-system-generator-to-build-web-layout/</link>
		<comments>http://superdit.com/2011/08/24/27-css-grid-system-generator-to-build-web-layout/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 03:29:34 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[layout]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=8291</guid>
		<description><![CDATA[CSS grid based layout are becoming very commonly used these day, since it replacing table based layout, it will help a website designer to create lighter code and it make it easier to styling, even in some cases it can be use as a grid table too. In today post I collected the css grid<a href="http://superdit.com/2011/08/24/27-css-grid-system-generator-to-build-web-layout/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>CSS grid based layout are becoming very commonly used these day, since it replacing table based layout, it will help a website designer to create lighter code and it make it easier to styling, even in some cases it can be use as a grid table too.</p>
<p><a title="27 CSS Grid System &amp; Generator To Build Web Layout" href="http://superdit.com/2011/08/24/27-css-grid-system-generator-to-build-web-layout/"><img class="alignnone size-full wp-image-8335" title="css grid" src="http://superdit.com/wp-content/uploads/2011/08/cssgrid.jpg" alt="css grid" width="550" height="234" /></a></p>
<p>In today post I collected the css grid system that can be used as your grid layout system, I found 12  tools for creating the grid online and 15 that can be downloaded, so you can create manually on your computer.<span id="more-8291"></span></p>
<h4>Downloadable</h4>
<p>The first 15 tools are some css grid that available to download, some of them provide more than css grid, so it called a framework, and you might be need to dig a little bit to their documentation.</p>
<h6>520 Grid</h6>
<p><a title="520 Grid System" href="http://www.520grid.com/ " target="_blank"><img class="alignnone size-full wp-image-8298" title="520 Grid System" src="http://superdit.com/wp-content/uploads/2011/08/01-520-Grid-System.jpg" alt="520 Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Columnal</h6>
<p><a title="Columnal CSS Grid System" href=" http://www.columnal.com/" target="_blank"><img class="alignnone size-full wp-image-8300" title="Columnal CSS Grid System" src="http://superdit.com/wp-content/uploads/2011/08/02-Columnal.jpg" alt="Columnal CSS Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Blueprint CSS</h6>
<p><a title="Blueprint CSS" href="http://www.blueprintcss.org/" target="_blank"><img class="alignnone size-full wp-image-8301" title="Blueprint CSS" src="http://superdit.com/wp-content/uploads/2011/08/03-Blueprint.jpg" alt="Blueprint CSS" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>960gs</h6>
<p><a title="960gs" href="http://960.gs/ " target="_blank"><img class="alignnone size-full wp-image-8302" title="960 Grid System" src="http://superdit.com/wp-content/uploads/2011/08/04-960-Grid-System.jpg" alt="960 Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>1140 CSS Grid</h6>
<p><a title="1140 CSS Grid" href="http://cssgrid.net/ " target="_blank"><img class="alignnone size-full wp-image-8303" title="The 1140px" src="http://superdit.com/wp-content/uploads/2011/08/05-The1140px.jpg" alt="The 1140px" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Bluetrip</h6>
<p><a title="Bluetrip CSS Framework" href="http://bluetrip.org/" target="_blank"><img class="alignnone size-full wp-image-8304" title="BlueTrip" src="http://superdit.com/wp-content/uploads/2011/08/06-BlueTrip.jpg" alt="BlueTrip" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>52 Framework</h6>
<p><a title="52 Framework" href="http://www.52framework.com/" target="_blank"><img class="alignnone size-full wp-image-8305" title="52 framework" src="http://superdit.com/wp-content/uploads/2011/08/07-52framework.jpg" alt="52 framework" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Baseline CSS</h6>
<p><a title="Baselinecss" href="http://baselinecss.com/" target="_blank"><img class="alignnone size-full wp-image-8306" title="Baseline" src="http://superdit.com/wp-content/uploads/2011/08/08-Baseline.jpg" alt="Baseline" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Fluid Grid</h6>
<p><a title="Fluid Grid System" href="http://fluid.newgoldleaf.com/ " target="_blank"><img class="alignnone size-full wp-image-8307" title="Fluid Grid System" src="http://superdit.com/wp-content/uploads/2011/08/09-FluidGridSystem.jpg" alt="Fluid Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Notjustagrid</h6>
<p><a title="notjustagrid" href="http://www.notjustagrid.com/" target="_blank"><img class="alignnone size-full wp-image-8308" title="NotJustAGrid" src="http://superdit.com/wp-content/uploads/2011/08/10-NotJustAGrid.jpg" alt="NotJustAGrid" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Less Framework</h6>
<p><a title="Less Framework" href="http://lessframework.com/" target="_blank"><img class="alignnone size-full wp-image-8309" title="Less Framework" src="http://superdit.com/wp-content/uploads/2011/08/11-LessFramework4.jpg" alt="Less Framework" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Skeleton</h6>
<p><a title="Skeleton" href="http://www.getskeleton.com/ " target="_blank"><img class="alignnone size-full wp-image-8310" title="Skeleton" src="http://superdit.com/wp-content/uploads/2011/08/12-Skeleton.jpg" alt="Skeleton" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>1200 Grid System</h6>
<p><a title="1200 Grid System" href="http://www.sampsonvideos.com/" target="_blank"><img class="alignnone size-full wp-image-8311" title="1200 Grid System" src="http://superdit.com/wp-content/uploads/2011/08/13-1200-Grid-System.jpg" alt="1200 Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>YAML</h6>
<p><a title="YAML" href="http://www.yaml.de/en/home.html " target="_blank"><img class="alignnone size-full wp-image-8312" title="YAML" src="http://superdit.com/wp-content/uploads/2011/08/14-YAML.jpg" alt="YAML" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Golden Grid System</h6>
<p><a title="Golden Grid System" href="http://goldengridsystem.com/" target="_blank"><img class="alignnone size-full wp-image-8313" title="Golden Grid System" src="http://superdit.com/wp-content/uploads/2011/08/15-Golden_Grid_System.jpg" alt="Golden Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h4>Online Generator</h4>
<p>And the next 12 tools are the online css grid generator that can provide you the grid you need on the fly, customize the number of column, column width, column separator width, container width, etc. These tools are great to build fast layout.</p>
<h6>Tiny Fluid Grid</h6>
<p><a title="Tiny Fluid Grid" href="http://www.tinyfluidgrid.com/ " target="_blank"><img class="alignnone size-full wp-image-8315" title="Tiny Fluid Grid" src="http://superdit.com/wp-content/uploads/2011/08/16-Tiny_Fluid_Grid.jpg" alt="Tiny Fluid Grid" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>ZURB CSS Grid Builder</h6>
<p><a title="Zurb CSS Grid Builder" href="http://www.zurb.com/playground/css-grid-builder " target="_blank"><img class="alignnone size-full wp-image-8316" title="ZURB CSS Grid Builder" src="http://superdit.com/wp-content/uploads/2011/08/17-ZURB-CSS-Grid-Builder.jpg" alt="ZURB CSS Grid Builder" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Gridr Buildrrr</h6>
<p><a title="Gridr Builderrr" href="http://gridr.atomeye.com/" target="_blank"><img class="alignnone size-full wp-image-8317" title="Gridr Buildrrr" src="http://superdit.com/wp-content/uploads/2011/08/18-gridr-buildrrr.jpg" alt="Gridr Buildrrr" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Grid Calculator</h6>
<p><a title="Grid Calculator" href=" http://www.29digital.net/grid/" target="_blank"><img class="alignnone size-full wp-image-8318" title="Grid Calculator" src="http://superdit.com/wp-content/uploads/2011/08/19-Grid_Calculator.jpg" alt="Grid Calculator" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Gridinator</h6>
<p><a title="Gridinator" href="http://www.gridinator.com/" target="_blank"><img class="alignnone size-full wp-image-8319" title="Gridinator" src="http://superdit.com/wp-content/uploads/2011/08/20-GRIDINATOR.jpg" alt="Gridinator" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>1kb CSS Grid</h6>
<p><a title="1kb CSS Grid" href="http://www.1kbgrid.com/" target="_blank"><img class="alignnone size-full wp-image-8320" title="1KB CSS Grid" src="http://superdit.com/wp-content/uploads/2011/08/21-The-1KB-CSS-Grid.jpg" alt="1KB CSS Grid" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>YUI CSS Grid Builder</h6>
<p><a title="YUI CSS Grid Builder" href="http://developer.yahoo.com/yui/grids/builder/" target="_blank"><img class="alignnone size-full wp-image-8321" title="YUI CSS Grid Builder" src="http://superdit.com/wp-content/uploads/2011/08/22-YUI-CSSGridBuilder.jpg" alt="YUI CSS Grid Builder" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>YAML Builder</h6>
<p><a title="YAML Builder" href="http://builder.yaml.de/ " target="_blank"><img class="alignnone size-full wp-image-8322" title="YAML Builder" src="http://superdit.com/wp-content/uploads/2011/08/23-YAMLBuilder.jpg" alt="YAML Builder" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Inuit Grid Builder</h6>
<p><a title="Inuit Grid Builder" href="http://csswizardry.com/inuitcss/" target="_blank"><img class="alignnone size-full wp-image-8323" title="inuit css" src="http://superdit.com/wp-content/uploads/2011/08/24-inuit.jpg" alt="inuit css" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Net Protozo Grid Generator</h6>
<p><a title="Net Protozo Grid Generator" href="http://netprotozo.com/grid/" target="_blank"><img class="alignnone size-full wp-image-8324" title="Net Protozo Grid Generator" src="http://superdit.com/wp-content/uploads/2011/08/25-nP.jpg" alt="Net Protozo Grid Generator" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Variable Grid System</h6>
<p><a title="Variable Grid System" href="http://grids.heroku.com/" target="_blank"><img class="alignnone size-full wp-image-8325" title="Variable Grid System" src="http://superdit.com/wp-content/uploads/2011/08/26-VariableGridSystem.jpg" alt="Variable Grid System" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Construct</h6>
<p><a title="Construct" href="http://www.constructyourcss.com/ " target="_blank"><img class="alignnone size-full wp-image-8326" title="Construct" src="http://superdit.com/wp-content/uploads/2011/08/27-Construct.jpg" alt="Construct" width="550" height="250" /></a></p>
<hr class="hr-5" />
<h6>Negative Grid</h6>
<p><a title="NegativeGrid" href="http://chrisplaneta.com/freebies/negativegrid-fluid-css-grid-by-chris-planeta/" target="_blank"><img class="alignnone size-full wp-image-8501" title="NegativeGrid - fluid CSS grid by Chris Planeta" src="http://superdit.com/wp-content/uploads/2011/08/28-NegativeGrid-fluid-CSS-grid-by-Chris-Planeta.jpg" alt="NegativeGrid - fluid CSS grid by Chris Planeta" width="550" height="250" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/08/24/27-css-grid-system-generator-to-build-web-layout/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ExtJS: Load Grid From Another Grid</title>
		<link>http://superdit.com/2011/05/23/extjs-load-grid-from-another-grid/</link>
		<comments>http://superdit.com/2011/05/23/extjs-load-grid-from-another-grid/#comments</comments>
		<pubDate>Mon, 23 May 2011 09:54:46 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Extjs]]></category>
		<category><![CDATA[grid]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=6752</guid>
		<description><![CDATA[About last week I got a question from a friend in ExtJS subject, like this pst title said he asking how to load a grid from another grid, which mean the first grid loaded when the page load, and the second grid loads when a row in the first grid clicked. This is really simple<a href="http://superdit.com/2011/05/23/extjs-load-grid-from-another-grid/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">About last week I got a question from a friend in ExtJS subject, like this pst title said he asking how to load a grid from another grid, which mean the first grid loaded when the page load, and the second grid loads when a row in the first grid clicked.</p>
<p style="text-align: center;"><a title="ExtJS: Load Grid From Another Grid" href="http://superdit.com/2011/05/23/extjs-load-grid-from-another-grid/"><img class="alignnone size-full wp-image-6755" title="Extjs load grid from other grid" src="http://superdit.com/wp-content/uploads/2011/05/Extjs_load_grid_from_other_grid.jpg" alt="Extjs load grid from other grid" width="524" height="158" /></a></p>
<p style="text-align: left;">This is really simple actually, in this example I&#8217;m using static json file as a data source, the data are the company list and the company product list, i get all this data from wikipedia.<span id="more-6752"></span></p>
<p style="text-align: center;"><a title="ExtJS: load grid fro others grid demo" href="http://demo.superdit.com/extjs/load_grid_from_other_grid/" target="_blank">view demo</a> | <a title="ExtJS load grid from another grid download" href="http://www.box.net/shared/7dz1cam6eg" target="_blank">download source</a></p>
<p style="text-align: left;">First let define the data by creating two json file, I named <em>company.json</em> and <em>products.json</em>, these two data connected by <em>company_id </em>property that defined in products.json. Here the code look a like.</p>
<h5 style="text-align: left;">Company.json</h5>
<pre class="brush: jscript; title: ; notranslate">
{'companies': [{
    'id': '1',
    'name': 'Google',
    'founded': 'September 4, 1998',
    'people': 'Sergey Brin, Larry Page'
}, {
    'id': '2',
    'name': 'Microsoft',
    'founded': 'April 4, 1975',
    'people': 'Bill Gates, Paul Allen'
}, {
    'id': '3',
    'name': 'Yahoo',
    'founded': 'March 1, 1995',
    'people': 'Jerry Yang, David Filo'
}
]}
</pre>
<h5 style="text-align: left;">Products.js</h5>
<pre class="brush: jscript; title: ; notranslate">
{'products': [{
    'company_id': '1',
    'name': 'Google Analytics',
    'type': 'Web Statistics'
}, {
    'company_id': '1',
    'name': 'Gmail',
    'type': 'Communication'
}, {
    'company_id': '2',
    'name': 'Xbox',
    'type': 'Game Console'
}, {
    'company_id': '2',
    'name': 'Bing',
    'type': 'Web Search'
}, {
    'company_id': '3',
    'name': 'Yahoo! Publisher Network',
    'type': 'Web Advertising'
}
]}
</pre>
<h5 style="text-align: left;">Full Source Code</h5>
<pre class="brush: jscript; title: ; notranslate">
Ext.onReady(function() {
   Ext.define('Company', {
       extend: 'Ext.data.Model',
       fields: ['id', 'name', 'founded', 'people']
   });

   var store_company = new Ext.data.Store({
      model: 'Company',
      proxy: {
          type: 'ajax',
          url: 'company.json',
          reader: {
              type: 'json',
              root: 'companies'
          }
      }
   });

    var grid_company = Ext.create('Ext.grid.Panel', {
        store: store_company,
        columns: [
            {
                text     : 'Company Name',
                dataIndex: 'name'
            },
            {
                text     : 'Founded',
                width    : 200,
                dataIndex: 'founded'
            },
            {
                text     : 'Key People',
                width    : 250,
                dataIndex: 'people'
            }
        ],
        height: 200,
        width: 550,
        title: 'Company List',
        renderTo: 'grid-company',
        viewConfig: {
            stripeRows: true
        },
        listeners: {
            itemclick : function() {
                var data = grid_company.getSelectionModel().selected.items[0].data;
                grid_product.setTitle(data.name + ' Products List');
                store_product.clearFilter();
                store_product.filter('company_id', data.id);
                store_product.load();
            }
        }
    });

    store_company.load();

    Ext.define('Product', {
       extend: 'Ext.data.Model',
       fields: ['company_id', 'name', 'type']
    });

    var store_product = new Ext.data.Store({
      model: 'Product',
      proxy: {
          type: 'ajax',
          url: 'products.json',
          reader: {
              type: 'json',
              root: 'products'
          }
      }
    });

    var grid_product = Ext.create('Ext.grid.Panel', {
        store: store_product,
        columns: [
            {
                text     : 'Product Name',
                dataIndex: 'name',
                width    : 350,
            },
            {
                text     : 'Type',
                width    : 200,
                dataIndex: 'type'
            }
        ],
        height: 200,
        width: 550,
        title: 'Product List',
        renderTo: 'grid-product',
        viewConfig: {
            stripeRows: true
        }
    });
});
</pre>
<p style="text-align: left;">The main function in this example is the <em>itemclick </em>listener on the company name grid, we can directly filter the store by using <em>filter()</em> method, but remember to use <em>clearFilter()</em> too, otherwise each time the filter called, the filter condition will be stacked, somekind the &#8220;and&#8221; operator in programming.</p>
<pre class="brush: jscript; title: ; notranslate">
listeners: {
    itemclick : function() {
        var data = grid_company.getSelectionModel().selected.items[0].data;
        grid_product.setTitle(data.name + ' Products List');
        store_product.clearFilter();
        store_product.filter('company_id', data.id);
        store_product.load();
    }
}
</pre>
<p style="text-align: left;">That a simple example using the static json data, to use other data like array or dynamic data, like fetching from php, you can modified the store component for example using the arraystore.</p>
<p style="text-align: center;"><a title="ExtJS: load grid fro others grid demo" href="http://demo.superdit.com/extjs/load_grid_from_other_grid/" target="_blank">view demo</a> | <a title="ExtJS load grid from another grid download" href="http://www.box.net/shared/7dz1cam6eg" target="_blank">download source</a></p>
<p style="text-align: center;"><a href="http://demo.superdit.com/extjs/load_grid_from_other_grid/" target="_blank"><img class="alignnone size-full wp-image-6756" title="Extjs load grid from other grid" src="http://superdit.com/wp-content/uploads/2011/05/Extjs_load_grid_from_other_grid.png" alt="Extjs load grid from other grid" width="540" height="440" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/05/23/extjs-load-grid-from-another-grid/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Google Web Seach With ExtJS Grid and PHP</title>
		<link>http://superdit.com/2011/01/24/google-web-seach-with-extjs-grid-and-php/</link>
		<comments>http://superdit.com/2011/01/24/google-web-seach-with-extjs-grid-and-php/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 06:02:31 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Extjs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=4138</guid>
		<description><![CDATA[This time I want to make a simple example in displaying google web search result in ExtJS grid, other ExtJS component that can be used to displaying this result is dataview, but grid is more common in displaying data in ExtJS, to use google search API you have to signup to get an API key,<a href="http://superdit.com/2011/01/24/google-web-seach-with-extjs-grid-and-php/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>This time I want to make a simple example in displaying google web search result in ExtJS grid, other ExtJS component that can be used to displaying this result is dataview, but grid is more common in displaying data in ExtJS, to use google search API you have to <a href="http://code.google.com/apis/loader/signup.html" target="_blank">signup</a> to get an API key, one key is only for one domain.</p>
<p><a title="Google API Key Signup" href="http://code.google.com/apis/loader/signup.html" target="_blank"><img class="aligncenter size-full wp-image-4507" title="Google API Key" src="http://superdit.com/wp-content/uploads/2011/01/api-key.png" alt="Google API Key" width="540" height="210" /><span id="more-4138"></span></a></p>
<p>If you want to know the detail about google search API, you can refer this <a href="http://code.google.com/apis/websearch/docs/reference.html" target="_blank">link</a>.</p>
<h6>The ExtJS Code</h6>
<p>The ExtJS code contains Windows, gridPanel, pagingToolbar, searchField</p>
<pre class="brush: jscript; title: ; notranslate">
Ext.onReady(function() {
    var store = new Ext.data.JsonStore({
        root: 'results',
        totalProperty: 'totalCount',
        remoteSort: true,

        fields: [
            'GsearchResultClass',
            'unescapedUrl',
            'url',
            'visibleUrl',
            'cacheUrl',
            'title',
            'titleNoFormatting',
            'content'
        ],

        proxy: new Ext.data.HttpProxy({
            url: 'search.php'
        })
    });

    function renderResult(value, p, record){
        return String.format(
            '&lt;a class=&quot;link&quot; href=&quot;{1}&quot; target=&quot;_blank&quot;&gt;{0}&lt;/a&gt;',
            record.data.title, record.data.unescapedUrl);
    }

    var grid = new Ext.grid.GridPanel({
        border: false,
        width: 485,
        height: 430,
        store: store,
        loadMask: true,
        columns: [{
            header: 'Results',
            dataIndex: 'title',
            width: 480,
            renderer: renderResult
        }],

        viewConfig: {
            forceFit:true,
            enableRowBody:true,
            showPreview:true,
            getRowClass : function(record, rowIndex, p, store){
                p.body = '&lt;p class=&quot;excerpt&quot;&gt;'+record.data.content+'&lt;/p&gt;';
            }
        },
        tbar: [
            '-&gt;',
            new Ext.ux.form.SearchField({
                store: store,
                width: 200,
                emptyText: 'Google Search'
            })
        ],
        bbar: new Ext.PagingToolbar({
            pageSize: 8,
            store: store,
            displayInfo: true
        })
    });

    var window = new Ext.Window({
        title: 'Google Web Search - ExtJS &amp; PHP',
        width: 500,
        height: 460,
        closable: false,
        resizable: false,
        items: [grid]
    }).show();
});
</pre>
<p><strong>The Search Field</strong> used is from the <em>ExtJS ux</em> you can found it on the example section, and it placed in the gridPanel toolbar, inside the <strong>GridPanel</strong> there is a <em>viewConfig, </em>I&#8217;m following this <a href="http://dev.sencha.com/deploy/dev/examples/grid/paging.html" target="_blank">example</a>, this is for displaying search result content (short description)</p>
<h6>The PHP Code</h6>
<p>The PHP code used to make me easier generating json format so ExtJS can be easily read all the data</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 8;

$q = str_replace(&quot; &quot;, &quot;%20&quot;, $_REQUEST['query']);
$key = &quot;insert your key&quot;;

$url = 'https://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q='.$q.'&amp;start='.$start.'&amp;rsz='.$limit.'&amp;key='.$key;

$content = file_get_contents($url);
$array = json_decode($content);

$data = array();

foreach ($array-&gt;responseData-&gt;results as $var =&gt; $value)
{
    $data[] = array(
        &quot;GsearchResultClass&quot; =&gt; $value-&gt;GsearchResultClass,
        &quot;unescapedUrl&quot;       =&gt; $value-&gt;unescapedUrl,
        &quot;visibleUrl&quot;         =&gt; $value-&gt;visibleUrl,
        &quot;cacheUrl&quot;           =&gt; $value-&gt;cacheUrl,
        &quot;title&quot;              =&gt; $value-&gt;title,
        &quot;titleNoFormatting&quot;  =&gt; $value-&gt;titleNoFormatting,
        &quot;content&quot;            =&gt; $value-&gt;content
    );
}

$out = array(
    &quot;success&quot; =&gt; true,
    &quot;totalCount&quot; =&gt; $array-&gt;responseData-&gt;cursor-&gt;estimatedResultCount,
    &quot;results&quot; =&gt; $data
);

echo json_encode($out);

?&gt;
</pre>
<h6>The CSS Code</h6>
<p>This is the simple CSS code for customizing the grid row style</p>
<pre class="brush: css; title: ; notranslate">
.link {
    color: #333;
    line-height: 25px;
    text-decoration: none;
    font-size: 13px;
    padding: 5px 10px;
    display: block;
    -webkit-border-radius: 1.0em;
    -moz-border-radius: 1.0em;
    border-radius: 1.0em;
}
.link:hover {
    background: #333;
    color: #f3f3f3;
}
.excerpt {
    padding: 5px 20px;
    color: #999;
}
</pre>
<p>Here is the result</p>
<p style="text-align: center;"><a href="http://demo.superdit.com/ext_php_google/" target="_blank"><img class="aligncenter size-full wp-image-4498" title="Google Web Search With ExtJS &amp; PHP" src="http://superdit.com/wp-content/uploads/2011/01/screenshot.png" alt="Google Web Search With ExtJS &amp; PHP" width="509" height="471" /></a></p>
<h6 style="text-align: center;"><a href="http://demo.superdit.com/ext_php_google/" target="_blank">View Demo</a> | <a href="http://www.box.net/shared/iyf2x8or8h" target="_blank">Download Source</a></h6>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2011/01/24/google-web-seach-with-extjs-grid-and-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CRUD using CodeIgniter and EXTJS Grid – Part 3</title>
		<link>http://superdit.com/2010/07/13/crud-using-codeigniter-and-extjs-grid-part-3/</link>
		<comments>http://superdit.com/2010/07/13/crud-using-codeigniter-and-extjs-grid-part-3/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 03:55:08 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Extjs]]></category>
		<category><![CDATA[grid]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=1561</guid>
		<description><![CDATA[This is the final post of the series CodeIgniter and Extjs CRUD, if you want to read the previous posts, here the first part and the second part of this post. Basically we already finish all the crud feature on the second part this only another common feature to add in the application, so we<a href="http://superdit.com/2010/07/13/crud-using-codeigniter-and-extjs-grid-part-3/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>This is the final post of the series CodeIgniter and Extjs CRUD, if you want to read the previous posts, here <a href="http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/" target="_blank">the first part</a> and <a href="http://superdit.com/2010/07/12/crud-using-codeigniter-and-extjs-grid-part-2/" target="_blank">the second part</a> of this post. Basically we already finish all the crud feature on the second part this only another common feature to add in the application, so we will add a quick search  field on the grid, and what you need is the search grid plugin, I&#8217;m using the extjs example search field plugin from this <a title="Tutorial:Grid PHP SQL Part1" href="http://www.sencha.com/learn/Tutorial:Grid_PHP_SQL_Part1" target="_self">extjs grid tutorial</a>, you can download the complete code and find this file <em>searchfield.js </em>and put it your desire folder, in this post i put on the <em>&#8220;assets/js/ext/plugins/&#8221; </em>folder. Now all you have to do just include the js file in the view file and change the controller method.<span id="more-1561"></span></p>
<p><strong>This is what to be included in view</strong> <em>&#8220;system/views/user/index.php&#8221;</em></p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php echo base_url(); ?&gt;assets/js/ext/plugins/searchfield.js&quot;; ?&gt;&quot;&gt;&lt;/script&gt;
</pre>
<p>Create and add new search field plugin to the grid toolbar</p>
<pre class="brush: jscript; title: ; notranslate">
// the new search field
var searchUsers = new Ext.app.SearchField({
    store: strUsers,
    params: {start: 0, limit: 10},
    width: 180,
    id: 'fieldUsersSearch'
});

// add to the toolbar grid
var tbUsers = new Ext.Toolbar({
    items:[{
        text: 'Add',
        icon: BASE_ICONS + 'user_add.png',
        handler: function() {
            var User = gridUsers.getStore().recordType;
            var u = new User({
                fullname: 'New Full Name',
                email: 'New Email',
                country: 'Water Seven',
                occupation: 'Occupation',
                birthdate: '1899-10-10'
            });
            gridUsers.stopEditing();
            strUsers.insert(0, u);
            gridUsers.startEditing(0, 0);
        }
    }, '-', {
        text: 'Save Selected',
        disabled: true,
        id: 'btnSave',
        icon: BASE_ICONS + 'save.gif',
        handler: updateUsers
    }, '-', {
        text: 'Delete',
        icon: BASE_ICONS + 'user_delete.png',
        handler: deleteUsers
    }, '-&gt;', searchUsers]
});
</pre>
<p>Alternatively you can use saki grid search plugin follow this link <a href="http://gridsearch.extjs.eu/" target="_blank">http://gridsearch.extjs.eu/</a></p>
<p><strong>And a little modification in controller</strong> <em>&#8220;system/controller/user.php&#8221;</em></p>
<p>When<em> </em>you add search grid and doing a search query, the search field will give <em>$_POST['query'] </em>to the server and all we have to do is check whether the <em>$_POST['query'] </em>is set or not, if is set then do some query LIKE, in codeigniter you can see on the <a href="http://codeigniter.com/user_guide/database/active_record.html#select" target="_blank">active record class</a> .</p>
<pre class="brush: php; title: ; notranslate">
public function ext_get_all()
{
    $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
    $limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10;

    if (isset($_POST['query']))
    {
        $this-&gt;db-&gt;like('users.fullname', $_POST['query']);
        $this-&gt;db-&gt;or_like('users.email', $_POST['query']);
        $this-&gt;db-&gt;or_like('users.occupation', $_POST['query']);
        $this-&gt;db-&gt;or_like('users.birthdate', $_POST['query']);
        $this-&gt;db-&gt;or_like('countries.country_name', $_POST['query']);
    }

    $this-&gt;db-&gt;select('users.*, countries.country_name');
    $this-&gt;db-&gt;from('users');
    $this-&gt;db-&gt;join('countries',
            'countries.id = users.country_id');
    $this-&gt;db-&gt;order_by('users.fullname');

    $this-&gt;db-&gt;limit($limit, $start);

    $query = $this-&gt;db-&gt;get();
    $results = $this-&gt;db-&gt;count_all('users');
    $arr = array();
    foreach ($query-&gt;result() as $obj)
    {
        $arr[] = $obj;
    }
    echo '{success:true,results:'. $results .
            ',rows:'.json_encode($arr).'}';
}
</pre>
<p>you can download all the source code in this post and here the final screen thumbnail result from all the of the post</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-1571" title="localhost_ci_extjs_crud3" src="http://superdit.com/wp-content/uploads/2010/07/localhost_ci_extjs_crud3.png" alt="ci_extjs_crud_3_final" width="500" height="235" /></p>
<p style="text-align: center;"><a href="http://www.2shared.com/file/wJPFd-TG/CRUD_using_CodeIgniter_and_EXT.html" target="_blank">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/07/13/crud-using-codeigniter-and-extjs-grid-part-3/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>CRUD using CodeIgniter and EXTJS Grid – Part 2</title>
		<link>http://superdit.com/2010/07/12/crud-using-codeigniter-and-extjs-grid-part-2/</link>
		<comments>http://superdit.com/2010/07/12/crud-using-codeigniter-and-extjs-grid-part-2/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 07:45:48 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Extjs]]></category>
		<category><![CDATA[grid]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=1544</guid>
		<description><![CDATA[This post is continuation of the part 1, in part 1 we already created the Extjs grid with pagination and load the store grid from the database, in this part we will add the save, edit and delete feature to that grid, and for make it easier it will use the editor grid. First Edit<a href="http://superdit.com/2010/07/12/crud-using-codeigniter-and-extjs-grid-part-2/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>This post is continuation of the <a href="http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/" target="_blank">part 1</a>, in part 1 we already created the Extjs grid with pagination and load the store grid from the database, in this part we will add the save, edit and delete feature to that grid, and for make it easier it will use the editor grid.</p>
<p><strong>First Edit The View </strong>( in <em>&#8220;application/views/user/index.php&#8221; )</em></p>
<p>We will use the editorGrid, one of them should be editable on the combobox field and the value is fetched from the database, so we create country store component and set like the code below (in this step we haven&#8217;t created the method to get all countries. it described in the controller section).<span id="more-1544"></span></p>
<pre class="brush: jscript; title: ; notranslate">
var strCountries = new Ext.data.Store({
    reader: new Ext.data.JsonReader({
        fields: ['id', 'country_name'], root: 'countries'
    }),
    proxy: new Ext.data.HttpProxy({
        url: BASE_URL + 'user/ext_get_all_countries', method: 'POST'
    })
});
</pre>
<p>Now edit the toolbar so it can manipulate the grid and the data inside it, the <em>&#8220;Add&#8221; </em>button<em> </em>is to creating new data by adding the new row on the grid, and the user has to double click the new row to be edited. <em>&#8220;Save Selected&#8221; </em>button is to save the selected row button, it means user have to click the button and select the row to be saved, means can save multiple row at the save time. Last is <em>&#8220;Delete&#8221; </em>button that can be delete multiple row.</p>
<pre class="brush: jscript; title: ; notranslate">
var tbUsers = new Ext.Toolbar({
    items:[{
        text: 'Add',
        icon: BASE_ICONS + 'user_add.png',
        handler: function() {
            var User = gridUsers.getStore().recordType;
            var u = new User({
                fullname: 'New Full Name',
                email: 'New Email',
                country: 'Water Seven',
                occupation: 'Occupation',
                birthdate: '1899-10-10'
            });
            gridUsers.stopEditing();
            strUsers.insert(0, u);
            gridUsers.startEditing(0, 0);
        }
    }, '-', {
        text: 'Save Selected',
        disabled: true,
        id: 'btnSave',
        icon: BASE_ICONS + 'save.gif',
        handler: updateUsers
    }, '-', {
        text: 'Delete',
        icon: BASE_ICONS + 'user_delete.png',
        handler: deleteUsers
    }]
});

function updateUsers() {
    var sm = gridUsers.getSelectionModel();
    var sel = sm.getSelections();
    var data = '';
    for (i = 0; i&lt;sel.length; i++) {
        data = data + sel[i].get('id') + ';'
                + sel[i].get('fullname')
                + ';' + sel[i].get('email')
                + ';' + sel[i].get('country_id')
                + ';' + sel[i].get('occupation')
                + ';' + sel[i].get('birthdate')
                + '||';
    }
    Ext.Ajax.request({
        url: BASE_URL + 'user/ext_update',
        method: 'POST',
        params: { postdata: data }
    });
    strUsers.load();
}

function deleteUsers() {
    Ext.Msg.show({
        title: 'Confirm',
        msg: 'Delete Selected Users ?',
        buttons: Ext.Msg.YESNO,
        fn: function(btn) {
            if (btn == 'yes') {
                var sm = gridUsers.getSelectionModel();
                var sel = sm.getSelections();
                var data = '';
                for (i = 0; i&lt;sel.length; i++) {
                    data = data + sel[i].get('id') + ';';
                }
                Ext.Ajax.request({
                    url: BASE_URL + 'user/ext_delete',
                    method: 'POST',
                    params: { postdata: data }
                });
                strUsers.load();
            }
        }
    });
}
</pre>
<p>And don&#8217;t forget to change the grid panel component from <em>Ext.grid.GridPanel</em> to <em>Ext.grid.EditorGridPanel </em>and add the editor property to each column like this one.</p>
<pre class="brush: jscript; title: ; notranslate">
columns: [
    cbGrid, {
        header: &quot;Fullname&quot;,
        dataIndex: 'fullname',
        width: 180,
        editor: new Ext.form.TextField({
            allowBlank: false
        })
    }, {
        header: &quot;Email&quot;,
        dataIndex: 'email',
        width: 180,
        editor: new Ext.form.TextField({
            allowBlank: false,
            vtype: 'email'
        })
    }, {
        header: &quot;Country&quot;,
        dataIndex: 'country_name',
        width: 120,
        editor: new Ext.form.ComboBox({
            id: 'cbCountry',
            triggerAction: 'all',
            store: strCountries,
            valueField: 'id',
            displayField: 'country_name'
        })
    }, {
        header: &quot;Occupation&quot;,
        dataIndex: 'occupation',
        width: 120,
        editor: new Ext.form.TextField({
            allowBlank: false
        })
    }, {
        header: &quot;Birth&quot;,
        dataIndex: 'birthdate',
        width: 80,
        renderer : Ext.util.Format.dateRenderer('d/m/Y'),
        editor: new Ext.form.DateField({
            format: 'd/m/Y',
            allowBlank: false
        })
    }
]
</pre>
<p><strong>Second Edit The Controller</strong> (in <em>&#8220;application/controllers/user.php&#8221;)</em></p>
<p>Add new function inside the controller to get all the countries, add user, edit user and delete user. The first snippet below is function to get all the countries data, ideally I always create another controller because it accessing the different table and this country data have <em>&#8220;has one&#8221; </em>relationship to user controller, but in this post to make it fast I put that function in the same controller.</p>
<pre class="brush: php; title: ; notranslate">
public function ext_get_all_countries()
{
    $this-&gt;db-&gt;order_by('country_name');
    $query = $this-&gt;db-&gt;get('countries');
    $json = &quot;{'countries':[&quot;;
    foreach($query-&gt;result() as $data)
    {
        $json .= '{&quot;id&quot;:&quot;'.$data-&gt;id .
                '&quot;, country_name:&quot;' . $data-&gt;country_name.'&quot;},';
    }
    $json .= &quot;]}&quot;;
    echo $json;
}
</pre>
<p>And next is adding function for adding new data and edit existing data, you can see below there are looping when inserting the data, it because from the Extjs grid send multiple value, so I need to break down in array using <em>explode</em> function ini PHP, and there some converting date format cause the Extjs given the different date format when converting to string than mysql.</p>
<pre class="brush: php; title: ; notranslate">
public function ext_update()
{
    /* ex ext date: 1899-11-27T00:00:00
       mysql : YYYY-MM-DD */

    $records = explode('||', $_POST['postdata']);

    foreach ($records as $row)
    {
        $field = explode(';', $row);

        $birthdate = substr($field[5], 0, 10);

        $data = array(
            'fullname' =&gt; $field[1],
            'email' =&gt; $field[2],
            'occupation' =&gt; $field[4],
            'birthdate' =&gt; $birthdate
        );

        if (is_numeric($field[3]))
        {
            $data['country_id'] = $field[3];
        }
        else
        {
            $data['country_id'] = 1;
        }

        if (is_numeric($field[0]))
        {
            $this-&gt;db-&gt;where('id', $field[0]);
            $this-&gt;db-&gt;update('users', $data);
        }
        else
        {
            $this-&gt;db-&gt;insert('users', $data);
        }
    }
}
</pre>
<p>And the last is to delete all selected row from the grid, it is the way from the above snippet, the id that we want to deleted<br />
consolidated in one string, and php explode it to an array</p>
<pre class="brush: php; title: ; notranslate">
public function ext_delete()
{
    $records = explode(';', $_POST['postdata']);
    foreach($records as $id)
    {
        $this-&gt;db-&gt;where('id', $id);
        $this-&gt;db-&gt;delete('users');
    }
}
</pre>
<p>Well that for the part two, most feature have already been added for the CRUD grid, for part just for finishing I may add a quaick search field on the grid, and here&#8217;s below the complete code from this post.</p>
<p style="text-align: center;"><a href="http://www.box.net/shared/9f0h7e6q0q" target="_blank">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/07/12/crud-using-codeigniter-and-extjs-grid-part-2/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>CRUD using CodeIgniter and EXTJS Grid &#8211; Part 1</title>
		<link>http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/</link>
		<comments>http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 02:50:42 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[Extjs]]></category>
		<category><![CDATA[grid]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=1406</guid>
		<description><![CDATA[In this post I want to share how to create simple CRUD (create, read, update, delete) using codeigniter ExtJS editor grid. In this first part, we will setup the database schema, codeigniter and extjs. I limited this first part, only setup fetching data from database and pagination grid in extjs grid. 1. Create Database Schema<a href="http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>In this post I want to share how to create simple CRUD (create, read, update, delete) using codeigniter ExtJS editor grid. In this first part, we will setup the database schema, codeigniter and extjs. I limited this first part, only setup fetching data from database and pagination grid in extjs grid.</p>
<p><strong>1. Create Database Schema</strong></p>
<p>The table that we will use is two tables with &#8220;has one&#8221; relationship, namely users table with foreign key <em>country_id </em>and countries table that store all the countries data, so when we want to know the country name from the users we have to get from the countries table, and here the sql for creating the table.<span id="more-1406"></span></p>
<pre class="brush: sql; title: ; notranslate">
--
-- Table structure for table `countries`
--

CREATE TABLE IF NOT EXISTS `countries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country_name` varchar(150) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=102 ;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `fullname` varchar(150) NOT NULL,
  `email` varchar(100) NOT NULL,
  `country_id` int(11) NOT NULL DEFAULT '1',
  `occupation` varchar(150) NOT NULL,
  `birthdate` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ;
</pre>
<p><strong>2. Setup Codeigniter</strong></p>
<p>Like we always do in previous tutorial, there are the files that we have to setup: <em>config.php</em>, <em>database.php</em>, <em>autoload.php</em> and <em>route.php, </em>all this files are inside the same folder in codeigniter namely <em>&#8220;application/system/config&#8221;, </em>and<em> </em>don&#8217;t forget to setup the extjs file.<br />
<em>config.php </em>file</p>
<pre class="brush: php; title: ; notranslate">
$config['base_url'] = &quot;http://localhost/ci_extjs_crud/&quot;;
</pre>
<p><em>database.php</em> file</p>
<pre class="brush: php; title: ; notranslate">
$db['default']['hostname'] = &quot;localhost&quot;;
$db['default']['username'] = &quot;root&quot;;
$db['default']['password'] = &quot;&quot;;
$db['default']['database'] = &quot;ci_extjs_crud&quot;;
$db['default']['dbdriver'] = &quot;mysql&quot;;
</pre>
<p><em>autoload.php</em> file</p>
<pre class="brush: php; title: ; notranslate">
$autoload['libraries'] = array('database');
$autoload['helper'] = array('url');
</pre>
<p><em>route.php</em> file</p>
<pre class="brush: php; title: ; notranslate">
$route['default_controller'] = &quot;user&quot;;
</pre>
<p>we will create user class so set the default route to user and the extjs file looks on my project folder (inside codeigniter)</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-1520" title="ci-ext-folder" src="http://superdit.com/wp-content/uploads/2010/07/ci-ext-folder.png" alt="ci-ext-folder" width="242" height="254" /></p>
<p>I already remove only the used extjs file so, it much smaller than the fresh copy</p>
<p><strong>3. Create The Controller</strong></p>
<p>Create file <em>image.php </em>inside codeigniter controller folder and add this code below, this class only have 3 function. First function is to initialize the controller class, the <em>index </em>function only to render the view file and the <em>ext_get_all </em>function is to get the data from database that will displayed on the grid, you can see inside that function there are code to handle the pagination and the related table, the output from this function have to be in JSON format, so it will make easier to be displayed on Extjs grid.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

class User extends Controller {

    public function  __construct()
    {
        parent::Controller();
    }

    public function index()
    {
        $this-&gt;load-&gt;view('user/index');
    }

    public function ext_get_all()
    {
        $start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
	$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 10;

        $this-&gt;db-&gt;select('users.*, countries.country_name');
        $this-&gt;db-&gt;from('users');
        $this-&gt;db-&gt;join('countries',
                'countries.id = users.country_id');

        $this-&gt;db-&gt;limit($limit, $start);

        $query = $this-&gt;db-&gt;get();
        $results = $this-&gt;db-&gt;count_all('users');
        $arr = array();
        foreach ($query-&gt;result() as $obj)
        {
            $arr[] = $obj;
        }
        echo '{success:true,results:'. $results .
                ',rows:'.json_encode($arr).'}';
    }
}
</pre>
<p><strong>4. Create The View</strong></p>
<p>Create file <em>index.php </em>inside folder <em>&#8220;application/views/user/&#8221;, </em>just include the extjs file on the header that linked to file that we already setup on the step 2, and add this code below in the javascript tag (whatever you like whether in the separate file or in the same file)</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
var BASE_URL = '&lt;?php echo base_url(); ?&gt;' + 'index.php/';
var BASE_PATH = '&lt;?php echo base_url(); ?&gt;';
var BASE_ICONS = BASE_PATH + 'assets/icons/';
Ext.onReady(function() {
    var strUsers = new Ext.data.Store({
        reader: new Ext.data.JsonReader({
            fields: [
                'id', 'fullname', 'email', 'country_id',
                'country_name', 'occupation', 'birthdate'
            ],
            root: 'rows', totalProperty: 'results'
        }),
        proxy: new Ext.data.HttpProxy({
            url: BASE_URL + 'user/ext_get_all',
            method: 'POST'
        })
    });

    var tbUsers = new Ext.Toolbar({
        items:[{
            text: 'Add',
            icon: BASE_ICONS + 'user_add.png'
        }, '-', {
            text: 'Delete',
            icon: BASE_ICONS + 'user_delete.png'
        }]
    });

    var cbGrid = new Ext.grid.CheckboxSelectionModel();

    var gridUsers = new Ext.grid.GridPanel({
        frame: true, border: true, stripeRows: true, sm: cbGrid,
        store: strUsers, loadMask: true, title: 'Users List',
        style: 'margin:0 auto;', height: 330, width: 722,
        columns: [
            cbGrid, {
                header: &quot;Fullname&quot;,
                dataIndex: 'fullname',
                width: 180
            }, {
                header: &quot;Email&quot;,
                dataIndex: 'email',
                width: 180
            }, {
                header: &quot;Country&quot;,
                dataIndex: 'country_name',
                width: 120
            }, {
                header: &quot;Occupation&quot;,
                dataIndex: 'occupation',
                width: 120
            }, {
                header: &quot;Birth&quot;,
                dataIndex: 'birthdate',
                width: 80,
                renderer : Ext.util.Format.dateRenderer('d/m/Y')
            }
        ],
        tbar: tbUsers,
        bbar: new Ext.PagingToolbar({
            pageSize: 10,
            store: strUsers,
            displayInfo: true
        })
    });

    gridUsers.render('divgrid');
    strUsers.load();
});
&lt;/script&gt;
</pre>
<p>The first screenshot from this tutorial is something like this and you can download all the code below, i have included the sql schema and all the extjs file that needed in this post.</p>
<pre style="text-align: center;"><img class="alignnone size-full wp-image-1526" title="ExtJS CodeIgniter-CRUD_Part_1" src="http://superdit.com/wp-content/uploads/2010/07/ExtJS-CodeIgniter-CRUD_Part_1.png" alt="ExtJS CodeIgniter-CRUD_Part_1" width="500" height="238" /></pre>
<p style="text-align: center;"><a href="http://www.box.net/shared/nsdm0spb00" target="_blank">Download Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/07/10/crud-using-codeigniter-and-extjs-grid-part-1/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>EXTJS: Getting each row value from the grid</title>
		<link>http://superdit.com/2010/05/14/extjs-getting-each-row-value-from-the-grid/</link>
		<comments>http://superdit.com/2010/05/14/extjs-getting-each-row-value-from-the-grid/#comments</comments>
		<pubDate>Fri, 14 May 2010 02:44:12 +0000</pubDate>
		<dc:creator>aditia rahman</dc:creator>
				<category><![CDATA[Extjs]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://superdit.com/?p=495</guid>
		<description><![CDATA[When I write this post, a friend of mine asking me how to get the value from all the row in EXTJS grid, she use EditorGridPanel to make the grid editable by it&#8217;s user, and submit all edited value in each row to the server  i&#8217;m using php to take all the server side process).<a href="http://superdit.com/2010/05/14/extjs-getting-each-row-value-from-the-grid/" class="read-more">Continue Reading</a>]]></description>
			<content:encoded><![CDATA[<p>When I write this post, a friend of mine asking me how to get the value from all the row in <a title="extjs" href="http://extjs.com/" target="_blank">EXTJS</a> grid, she use EditorGridPanel to make the grid editable by it&#8217;s user, and submit all edited value in each row to the server  i&#8217;m using php to take all the server side process). Actually the idea is very simple, the grid need to have <em>sm</em> config options it is a shorthand for <em>selModel</em> and this config that make the grid can be selected per row, and you can added the <em>checkboxselection </em>model to choose the row that you desired, so trid to make it simple tutorial, and at the of the post you can download the source from this post.</p>
<p><strong>1. Setting the main page</strong><br />
Include the EXTJS file (javascript and css) in html header file, then create single div with an id to where the grid to put on, and i&#8217;m using inline css style to centering the div the on the page</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;extjs/resources/css/ext-all.css&quot;/&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;extjs/adapter/ext/ext-base.js&quot;; ?&gt;&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;extjs/ext-all.js&quot;; ?&gt;&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

/* This should be fill with the EXTJS script code
 * It explain on the next step
 */

// on the body section
&lt;body&gt;
&lt;div id=&quot;grid-example1&quot; style=&quot;height: 200px;width:600px;margin:0 auto;padding:20px;&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p><span id="more-495"></span></p>
<p><strong>2. Create the data in array for store inside the grid</strong><br />
To make it simple I using data for grid from an array, for more expert use, maybe using Json data reader will be fit</p>
<pre class="brush: jscript; title: ; notranslate">
var myData = [
	[1, 'Luffy', 'Monkey D Luffy', 'monkeyd@luffy.com', 'East Blue'],
	[2, 'Zoro', 'Roronoa Zoro', 'roronoa@zoro.com', 'East Blue'],
	[3, 'Sanji', 'Leg Sanji', 'sanji@baratie.net', 'East Blue'],
	[4, 'Usop', 'Soge King', 'usap@sogevillage.com', 'East Blue'],
	[5, 'Franky', 'Franky Cyborg', 'franky@water7.com', 'East Blue'],
	[6, 'Chopper', 'Tony Chopper', 'chopper@drum.com', 'East Blue']
];
</pre>
<p><strong>3. Create the data store for editable grid, in this case i&#8217;m using Form.ComboBox</strong></p>
<pre class="brush: jscript; title: ; notranslate">
// main store for grid
var store_mbti = new Ext.data.ArrayStore({
	fields: [
		{ name: 'id' }, { name: 'username' }, { name: 'full_name' },
		{ name: 'email' }, { name: 'village' }
	]
});

// store including the data for editable grid, using Form.ComboBox
var strVillage = new Ext.data.SimpleStore({
	fields: ['village'],
	data : [['Baratie'], ['Drum Island'],
		['Soge Island'],['Swordmen Land']]
});
</pre>
<p><strong>4. Create the checkboxselectionmodel</strong><br />
This component have to be created and included in grid config options named <em>sm</em>, the <em>selModel, </em>this is to make the entire single row selectable</p>
<pre class="brush: jscript; title: ; notranslate">
var cb_select = new Ext.grid.CheckboxSelectionModel();
</pre>
<p><strong>5. Create the main grid component</strong><br />
If you want the grid to be manually selectable by the user you need to add <em>cb_select </em>in the grid column header</p>
<pre class="brush: jscript; title: ; notranslate">
var grid_mbti = new Ext.grid.EditorGridPanel({
	store: store_mbti,  frame: true, border: true, autoHeight: true,
	resizable: true, loadMask: true, stripeRows: true,
	title:'Grid Select All', sm: cb_select,
	columns: [
		// cb_select, // uncomment, if using checkboxselectionmodel
		{ header: &quot;Username&quot;, dataIndex: 'username', },
		{ header: &quot;Full Name&quot;, dataIndex: 'full_name', width: 150 },
		{ header: &quot;Email&quot;, dataIndex: 'email', width: 150 },
		{ header: &quot;Village&quot;, dataIndex: 'village', width: 120,
			editor: new Ext.form.ComboBox({
				allowBlank: false,
				mode: 'local',
				store: strVillage,
				valueField: 'village',
				displayField: 'village',
				triggerAction: 'all',
				editable: false
			})
		}],
	tbar: [{
		text: 'Submit',
		handler: function() {
			// the implementation is in the next step
		}
	}]
});
</pre>
<p><strong>6. Load the store and render the grid</strong></p>
<pre class="brush: jscript; title: ; notranslate">
store_mbti.loadData(myData);
grid_mbti.render('grid-example1');
</pre>
<p>The alternative way from using render grid is, to add config option on grid named <em>renderTo</em> and fill it with html id that you desire</p>
<p><strong>7. Function handling on the toolbar, using ajax or not it&#8217;is up to you</strong><br />
Creating function handler should be in handler config in toolbar button, when I try my self it got some error on firebug</p>
<pre class="brush: jscript; title: ; notranslate">
// this implementation is inside button handler on step 5
handler: function() {
	grid_mbti.getSelectionModel().selectAll();
	var sm = grid_mbti.getSelectionModel().getSelections();
	var temp = '';
	for (i=0; i&lt;=sm.length-1; i++) {
		temp = temp + '|' + sm[i].get('village')
	}
	Ext.Ajax.request({
		url: 'process_data.php',
		method: 'POST',
		params: 'village=' + temp,
		success: function(obj) {
			var resp = obj.responseText;
			if (resp != 0) {
				Ext.MessageBox.alert('Success', resp + ' Processed');
			} else {
				Ext.MessageBox.alert('Failed', 'No Processed');
			}
		}
	});
}
</pre>
<p><strong>8. Handling the server side process</strong><br />
Like the previous step, the php file I called is <em>process_data.php, </em>the php script convert the variable received to an array, and then you can loop through the array</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

$arr_village = explode('|', $_POST['village']);
$count = count($arr_village) - 1;
if ($count != 0) {
    foreach ($arr_village as $value) {
        // data process in here, manipulate db or whatever
    }
    echo $count;
} else {
    echo 0;
}

?&gt;
</pre>
<p>The result screen should be like this, first before submit with the last one column editable</p>
<p style="text-align: center;"><img class="size-full wp-image-529 aligncenter" src="http://superdit.com/wp-content/uploads/2010/05/gridEditor_extjs.jpg" alt="" width="507" height="197" /></p>
<p>And after click the submit button on the top left of the grid toolbar, all the row in the grid should be selected</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-531" title="gridEditor_extjs2" src="http://superdit.com/wp-content/uploads/2010/05/gridEditor_extjs2.jpg" alt="" width="499" height="187" /></p>
<p>Yup that&#8217;s all, you can download all the code from the link below but once again i&#8217;m not included the <a title="extjs" href="http://extjs.com" target="_blank">EXTJS</a> file, you just can download it by your self on the official site. In the downloaded code I provide 2 grid with different use of selection model so you can clearly see the different, and I welcome for any suggestion from you thanks.</p>
<p><a title="Download Source" href="http://www.box.net/shared/ay7j8mlher" target="_blank">DOWNLOAD SOURCE</a></p>
]]></content:encoded>
			<wfw:commentRss>http://superdit.com/2010/05/14/extjs-getting-each-row-value-from-the-grid/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

