<?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>Pro-Tek Blog &#187; AG-Grid in Angular</title>
	<atom:link href="http://www.pro-tekconsulting.com/blog/tag/ag-grid-in-angular/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pro-tekconsulting.com/blog</link>
	<description>For UI developers / UI designers and UI trends</description>
	<lastBuildDate>Thu, 05 Sep 2019 03:59:47 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.0.34</generator>
	<item>
		<title>AG-GRID IN ANGULAR</title>
		<link>http://www.pro-tekconsulting.com/blog/ag-grid-in-angular/</link>
		<comments>http://www.pro-tekconsulting.com/blog/ag-grid-in-angular/#comments</comments>
		<pubDate>Fri, 18 Jan 2019 02:43:40 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[AG-Grid in Angular]]></category>

		<guid isPermaLink="false">http://www.pro-tekconsulting.com/blog/?p=2870</guid>
		<description><![CDATA[<p>AG-Grid in Angular: The &#8220;ag&#8221; part of ag-Grid stands for &#8220;agnostic&#8221;. The internal ag-Grid engine is executed in TypeScript with zero dependencies. ag-Grid supports Angular through a wrapper component. The wrapper lets the user to use ag-Grid in the application like any other Angular component. In this article, we will walk you through the essential [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/ag-grid-in-angular/">AG-GRID IN ANGULAR</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></description>
				<content:encoded><![CDATA[<h4>AG-Grid in Angular:</h4>
<p><img class="aligncenter size-medium wp-image-2872" src="http://www.pro-tekconsulting.com/blog/wp-content/uploads/2019/01/AG-Grid-in-Angular-300x238.jpg" alt="AG-Grid in Angular" width="300" height="238" /></p>
<p>The &#8220;ag&#8221; part of ag-Grid stands for &#8220;agnostic&#8221;. The internal ag-Grid engine is executed in TypeScript with zero dependencies. ag-Grid supports Angular through a wrapper component. The wrapper lets the user to use ag-Grid in the application like any other Angular component.</p>
<p>In this article, we will walk you through the essential steps to add ag-Grid to an existing Angular project, and configure some of the essential features of it.</p>
<p><strong>Adding ag-Grid to the project: </strong></p>
<p>ag-Grid and its Angular wrapper are distributed as NPM packages, which should work with any common Angular project module bundler setup. Let&#8217;s follow the Angular CLI instructions &#8211; run the following in the developer’s terminal:</p>
<p>npm install -g @angular/cli<br />
ng new my-app &#8211;style scss &#8211;routing false<br />
cd my-app<br />
ng serve</p>
<p>Further, add the ag-Grid NPM packages and run the following command in my-app:</p>
<p>npm install &#8211;save ag-grid-community ag-grid-angular</p>
<p>Now, let&#8217;s add the ag-Grid Angular module to the app module:</p>
<p>import { BrowserModule } from &#8216;@angular/platform-browser';<br />
import { NgModule } from &#8216;@angular/core';</p>
<p>import { AppComponent } from &#8216;./app.component';<br />
import { AgGridModule } from &#8216;ag-grid-angular';</p>
<p>@NgModule({<br />
declarations: [AppComponent],<br />
imports: [BrowserModule, AgGridModule.withComponents([])],<br />
providers: [],<br />
bootstrap: [AppComponent]<br />
})<br />
export class AppModule {}</p>
<p>The next step is to add the ag-Grid styles &#8211; import them in styles.scss:</p>
<p>@import &#8220;~ag-grid-community/dist/styles/ag-grid.css&#8221;;<br />
@import &#8220;~ag-grid-community/dist/styles/ag-theme-balham.css&#8221;;</p>
<p>The above code imports the grid &#8220;structure&#8221; stylesheet (ag-grid.css), and one of the available grid themes: (ag-theme-balham.css). The grid ships have some different themes; pick one that matches the project design.</p>
<p>Next, let&#8217;s declare the basic grid configuration. Edit src/app.component.ts:</p>
<p>import { Component } from &#8216;@angular/core';</p>
<p>@Component({<br />
selector: &#8216;app-root&#8217;,<br />
templateUrl: &#8216;./app.component.html&#8217;,<br />
styleUrls: [&#8216;./app.component.scss&#8217;]<br />
})<br />
export class AppComponent {<br />
title = &#8216;app';</p>
<p>columnDefs = [<br />
{headerName: &#8216;Make&#8217;, field: &#8216;make&#8217; },<br />
{headerName: &#8216;Model&#8217;, field: &#8216;model&#8217; },<br />
{headerName: &#8216;Price&#8217;, field: &#8216;price&#8217;}<br />
];</p>
<p>rowData = [<br />
{ make: &#8216;Toyota&#8217;, model: &#8216;Celica&#8217;, price: 35000 },<br />
{ make: &#8216;Ford&#8217;, model: &#8216;Mondeo&#8217;, price: 32000 },<br />
{ make: &#8216;Porsche&#8217;, model: &#8216;Boxter&#8217;, price: 72000 }<br />
];<br />
}</p>
<p>The above code represents two vital configuration properties of the grid &#8211; the column definitions and the data. In this case, the column definitions contain three columns, each column entry stipulates the header label and the data field to be displayed in the body of the table.</p>
<p>Finally, let&#8217;s add the component definition to the template. Edit app/app.component.html and remove the scaffold code:</p>
<p>&lt;ag-grid-angular<br />
style=&#8221;width: 500px; height: 500px;&#8221;<br />
class=&#8221;ag-theme-balham&#8221;<br />
[rowData]=&#8221;rowData&#8221;<br />
[columnDefs]=&#8221;columnDefs&#8221;<br />
&gt;<br />
&lt;/ag-grid-angular&gt;</p>
<p>This is the ag-grid component definition, with two property bindings &#8211; rowData and columnDefs. The component also accepts the standard DOM style and class.</p>
<p>The post <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog/ag-grid-in-angular/">AG-GRID IN ANGULAR</a> appeared first on <a rel="nofollow" href="http://www.pro-tekconsulting.com/blog">Pro-Tek Blog</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pro-tekconsulting.com/blog/ag-grid-in-angular/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
