﻿
{"id":9858,"date":"2018-11-26T20:47:30","date_gmt":"2018-11-26T20:47:30","guid":{"rendered":"http:\/\/www.gencayyildiz.com\/blog\/?p=9858"},"modified":"2018-11-26T20:47:30","modified_gmt":"2018-11-26T20:47:30","slug":"angular-adan-zye-smart-table-component-kullanimi","status":"publish","type":"post","link":"https:\/\/www.gencayyildiz.com\/blog\/angular-adan-zye-smart-table-component-kullanimi\/","title":{"rendered":"Angular &#8211; A&#8217;dan Z&#8217;ye Smart Table Component Kullan\u0131m\u0131"},"content":{"rendered":"<div id=\"fb-root\"><\/div>\n<p>Merhaba,<\/p>\n<p>Bu i\u00e7eri\u011fimizde Angular uygulamalar\u0131nda ak\u0131ll\u0131 tablo yap\u0131s\u0131 olan Smart Table componentini a&#8217;dan z&#8217;ye t\u00fcm \u00f6zellikleriyle ele alacak ve nas\u0131l kullan\u0131ld\u0131\u011f\u0131n\u0131 inceleyece\u011fiz. \u0130lgilenenler bilir ki, Angular mimarisinde kullan\u0131lmak \u00fczere in\u015fa edilmi\u015f birden fazla tablo componenti mevcuttur. Kimi sadece veri listeleme \u00f6zelli\u011fine sahipken, bir di\u011feri dahili CRUD i\u015flemlerini bar\u0131nd\u0131rmakta yahut tek bir tipte fonksiyonelli\u011fe sahip olmaktad\u0131r. Lakin bir\u00e7o\u011fu yaz\u0131l\u0131mc\u0131n\u0131n detaylara m\u00fcdahale etmesine izin vermemekte yahut ileri d\u00fczey tablo i\u015flevselliklerinde senaryoya beklenen esneklikte e\u015flik edememektedir.<\/p>\n<p>Smart Table componenti, Angular mimarisinde tablo ara\u00e7lar\u0131ndan etkili, esnek ve kullan\u0131\u015fl\u0131 \u00f6zellik sergileyen componentlerden biridir. Dahili olarak b\u00fcnyesinde bar\u0131nd\u0131rd\u0131\u011f\u0131 CRUD i\u015flemlerine ek olarak custom(\u00f6zel) yap\u0131lanmalar\u0131 desteklemekte, yaz\u0131l\u0131mc\u0131ya ihtiyaca d\u00f6n\u00fck \u00f6zelle\u015ftirilmi\u015f kolonlar olu\u015fturmas\u0131na m\u00fcsade etmekte ve t\u00fcm bunlar\u0131n yan\u0131nda kolonlara ba\u011fl\u0131 eventlar tan\u0131mlanmas\u0131n\u0131, filtreler uygulamas\u0131n\u0131, sayfalama yap\u0131lmas\u0131n\u0131 vs. desteklemektedir.<\/p>\n<p>\u015eimdi hi\u00e7 vakit kaybetmeden \u00f6rnek bir Angular uygulamas\u0131 \u00fczerinden Smart Table componentini incelemeye ba\u015flayal\u0131m.<\/p>\n<h3><span style=\"color: #800080;\">Uygulama Alt Yap\u0131s\u0131n\u0131 Haz\u0131rlama<\/span><\/h3>\n<p>\u0130lk olarak inceleme sahas\u0131n\u0131 haz\u0131rlayabilmek i\u00e7in Angular projesi olu\u015ftural\u0131m. Ard\u0131ndan konumuz bir table yap\u0131s\u0131 olaca\u011f\u0131ndan dolay\u0131 ihtiya\u00e7 duyaca\u011f\u0131m\u0131z veri kayna\u011f\u0131 i\u00e7in a\u015fa\u011f\u0131daki modeli, o modelden olu\u015facak koleksiyon yap\u0131s\u0131n\u0131 ve o koleksiyon yap\u0131s\u0131n\u0131 kullanabilmemizi sa\u011flayacak olan servisi olu\u015ftural\u0131m.<\/p>\n<table style=\"width: 100%;\">\n<tbody>\n<tr>\n<td style=\"text-align: center; width: 50%;\"><strong>Model<\/strong><\/td>\n<td style=\"text-align: center; width: 50%;\"><strong>Koleksiyon<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nexport class Ogrenci {\r\n     id: number;\r\n     adi: string;\r\n     soyAdi: string;\r\n     sinif: number;\r\n     cinsiyet: boolean;\r\n}\r\n<\/pre>\n<\/td>\n<td>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nexport const ogrenciler: Ogrenci&#x5B;] = &#x5B;];\r\n<\/pre>\n<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\" colspan=\"2\"><strong>Service<\/strong><\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { Injectable } from '@angular\/core';\r\nimport { Ogrenci } from '..\/entities\/ogrenci';\r\nimport { ogrenciler } from &quot;..\/entities\/ogrenci&quot;;\r\n@Injectable({\r\n  providedIn: 'root'\r\n})\r\nexport class OkulService {\r\n  constructor() { }\r\n  add(ogrenci: Ogrenci) {\r\n    ogrenciler.push(ogrenci);\r\n  }\r\n\r\n  remove(ogrenci: Ogrenci) {\r\n    let index = ogrenciler.indexOf(ogrenci);\r\n    ogrenciler.slice(index, 1);\r\n  };\r\n\r\n  get(): Ogrenci&#x5B;] {\r\n    return ogrenciler;\r\n  }\r\n}\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3><span style=\"color: #800080;\">Uygulamaya Smart Table Component Entegrasyonu ve Temel Ayarlar<\/span><\/h3>\n<p>Smart Table componentini uygulamaya entegre edebilmek i\u00e7in a\u015fa\u011f\u0131daki komutun \u00e7al\u0131\u015ft\u0131r\u0131lmas\u0131 yeterlidir.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnpm install --save ng2-smart-table\r\n<\/pre>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9867\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131.png\" alt=\"Angular - A'dan Z'ye Smart Table Component Kullan\u0131m\u0131\" width=\"1375\" height=\"188\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131.png 1375w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-300x41.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-768x105.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1024x140.png 1024w\" sizes=\"auto, (max-width: 1375px) 100vw, 1375px\" \/><\/a><\/p>\n<p>Uygulamaya entegre edilen Smart Table componentini, uygulamam\u0131z\u0131n ana mod\u00fcl\u00fc olan &#8220;app.module.ts&#8221; dosyas\u0131na a\u015fa\u011f\u0131daki gibi import ederek kullan\u0131labilir hale getirelim.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { BrowserModule } from '@angular\/platform-browser';\r\nimport { NgModule } from '@angular\/core';\r\n\r\nimport { AppComponent } from '.\/app.component';\r\nimport { Ng2SmartTableModule } from 'ng2-smart-table';\r\n\r\n@NgModule({\r\n  declarations: &#x5B;\r\n    AppComponent\r\n  ],\r\n  imports: &#x5B;\r\n    BrowserModule,\r\n    Ng2SmartTableModule\r\n  ],\r\n  providers: &#x5B;],\r\n  bootstrap: &#x5B;AppComponent]\r\n})\r\nexport class AppModule { }\r\n<\/pre>\n<p>Bu i\u015flemden sonra Smart Table componenti uygulamam\u0131za entegre edilmi\u015f ve kullan\u0131ma haz\u0131r bir vaziyettedir diyebiliriz.<\/p>\n<p>Componentimizi \u00f6rneklendirmek i\u00e7in varsay\u0131lan olarak gelen ve uygulaman\u0131n ana componenti olan &#8220;AppComponent&#8221; bizler i\u00e7in yeterli olacakt\u0131r.<\/p>\n<h4><span style=\"color: #008000;\">Temel Smart Table HTML Kodlar\u0131<\/span><\/h4>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n--- app.component.html ---\r\n&lt;ng2-smart-table &#x5B;settings]=&quot;settings&quot; &#x5B; source]=&quot;data&quot;&gt;&lt;\/ng2-smart-table&gt;\r\n<\/pre>\n<p>Smart Table, yukar\u0131da oldu\u011fu gibi &#8220;ng2-smart-table&#8221; html etiketi \u00fczerinden \u00e7al\u0131\u015fmaktad\u0131r. Bu yap\u0131 \u00fczerinde g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere &#8220;[settings]&#8221; ve &#8220;[ source]&#8221; alanlar\u0131 mevcuttur. &#8220;[settings]&#8221;, bas\u0131lacak Smart Table&#8217;\u0131n genel ayarlar\u0131n\u0131 bar\u0131nd\u0131ran bir \u00f6zellikken; &#8220;[ source]&#8221; ise bu tablonun listeleyece\u011fi veriyi temsil etmektedir.<\/p>\n<table style=\"width: 100%;\">\n<tbody>\n<tr>\n<td style=\"text-align: center;\"><strong>Settings<\/strong><\/td>\n<td style=\"text-align: center;\"><strong>Source<\/strong><\/td>\n<\/tr>\n<tr>\n<td>\nsource alan\u0131na verilen koleksiyon datas\u0131ndaki listelenecek kolonlar\u0131, tabloda ger\u00e7ekle\u015ftirilecek actionlar\u0131 yahut tablonun genel class vs. ayarlar\u0131n\u0131 yapt\u0131\u011f\u0131m\u0131z aland\u0131r. Bizler makalemizin bu noktas\u0131nda sadece kolon ayarlamas\u0131n\u0131 ele alaca\u011f\u0131z. \u0130lerideki sat\u0131rlarda bu alan\u0131 ilgilendiren di\u011fer \u00f6zelliklerede de\u011finece\u011fiz.<\/p>\n<p>\u00d6rnek kullan\u0131m;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131'\r\n      },\r\n      soyAdi: {\r\n        title: 'Soyad\u0131'\r\n      },\r\n      sinif: {\r\n        title: 'S\u0131n\u0131f'\r\n      },\r\n      cinsiyet: {\r\n        title: 'Cinsiyet'\r\n      }\r\n    }\r\n  };\r\n<\/pre>\n<\/td>\n<td>Ba\u011flanan veri k\u00fcmesini, settings alan\u0131ndaki &#8220;columns&#8221; alan\u0131ndaki de\u011ferlere g\u00f6re tabloya basacakt\u0131r.<\/td>\n<\/tr>\n<tr>\n<td colspan=\"2\">\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { Component, OnInit } from '@angular\/core';\r\nimport { OkulService } from '.\/services\/okul.service';\r\nimport { Ogrenci } from '.\/entities\/ogrenci';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: '.\/app.component.html',\r\n  styleUrls: &#x5B;'.\/app.component.css']\r\n})\r\nexport class AppComponent implements OnInit {\r\n\r\n  constructor(private okulService: OkulService) { }\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131'\r\n      },\r\n      soyAdi: {\r\n        title: 'Soyad\u0131'\r\n      },\r\n      sinif: {\r\n        title: 'S\u0131n\u0131f'\r\n      },\r\n      cinsiyet: {\r\n        title: 'Cinsiyet'\r\n      }\r\n    }\r\n  };\r\n\r\n  data: Ogrenci&#x5B;];\r\n  ngOnInit(): void {\r\n    this.okulService.add({\r\n      id: 1,\r\n      adi: 'Gen\u00e7ay',\r\n      soyAdi: 'Y\u0131ld\u0131z',\r\n      cinsiyet: true,\r\n      sinif: 4\r\n    });\r\n    this.okulService.add({\r\n      id: 2,\r\n      adi: 'Nevin',\r\n      soyAdi: 'Y\u0131ld\u0131z',\r\n      cinsiyet: false,\r\n      sinif: 3\r\n    });\r\n    this.okulService.add({\r\n      id: 3,\r\n      adi: 'Olcay',\r\n      soyAdi: 'G\u00fcdek',\r\n      cinsiyet: true,\r\n      sinif: 5\r\n    });\r\n    this.okulService.add({\r\n      id: 4,\r\n      adi: 'Hakan',\r\n      soyAdi: 'Sabuncu',\r\n      cinsiyet: true,\r\n      sinif: 2\r\n    });\r\n    this.okulService.add({\r\n      id: 5,\r\n      adi: 'Leyla',\r\n      soyAdi: 'Song\u00fcl',\r\n      cinsiyet: false,\r\n      sinif: 3\r\n    });\r\n    this.data = this.okulService.get();\r\n  }\r\n}\r\n<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Yukar\u0131da g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere birka\u00e7 veri ekleyerek &#8220;data&#8221; ve &#8220;settings&#8221; de\u011fi\u015fkenlerimizi olu\u015fturuyoruz.<br \/>\n\u015eimdi bu noktaya kadar temel Smart Table alt yap\u0131s\u0131n\u0131 atm\u0131\u015f bulunmaktay\u0131z. Neler yapt\u0131\u011f\u0131m\u0131z\u0131 g\u00f6rebilmek i\u00e7in &#8220;ng serve&#8221; komutu ile projemizi yay\u0131na alal\u0131m.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1.png\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"1375\" height=\"475\" class=\"aligncenter size-full wp-image-9879\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1.png 1375w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1-300x104.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1-768x265.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1-1024x354.png 1024w\" sizes=\"auto, (max-width: 1375px) 100vw, 1375px\" \/><\/a><\/p>\n<p>Projemizi yay\u0131na almak isterken yukar\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere bir hatayla kar\u015f\u0131la\u015ft\u0131k.<br \/>\nHatam\u0131z\u0131n metinsel hali a\u015fa\u011f\u0131daki gibidir;<br \/>\n<span style=\"font-size:9px;color:red;\"><br \/>\nERROR in .\/node_modules\/ng2-smart-table\/components\/cell\/cell.module.js<br \/>\nModule not found: Error: Can&#8217;t resolve &#8216;ng2-completer&#8217; in &#8216;C:\\Users\\mebitech\\Desktop\\SmartTable\\smartTable\\node_modules\\ng2-smart-table\\components\\cell&#8217;ERROR in .\/node_modules\/ng2-smart-table\/components\/cell\/cell-editors\/completer-editor.component.js<br \/>\nModule not found: Error: Can&#8217;t resolve &#8216;ng2-completer&#8217; in &#8216;C:\\Users\\mebitech\\Desktop\\SmartTable\\smartTable\\node_modules\\ng2-smart-table\\components\\cell\\cell-editors&#8217;<br \/>\nERROR in .\/node_modules\/ng2-smart-table\/components\/filter\/filter.module.js<br \/>\nModule not found: Error: Can&#8217;t resolve &#8216;ng2-completer&#8217; in &#8216;C:\\Users\\mebitech\\Desktop\\SmartTable\\smartTable\\node_modules\\ng2-smart-table\\components\\filter&#8217;<br \/>\nERROR in .\/node_modules\/ng2-smart-table\/components\/filter\/filter-types\/completer-filter.component.js<br \/>\nModule not found: Error: Can&#8217;t resolve &#8216;ng2-completer&#8217; in &#8216;C:\\Users\\mebitech\\Desktop\\SmartTable\\smartTable\\node_modules\\ng2-smart-table\\components\\filter\\filter-types&#8217;<br \/>\n<\/span><\/p>\n<p>Bu hatadan kurtulabilmek i\u00e7in Ng2 Completer, rxjs ve rxjs-compat paketlerinin projeye entegre edilmesi gerekmektedir.<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnpm install ng2-completer --save\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnpm install rxjs\r\n<\/pre>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnpm i rxjs-compat --save\r\n<\/pre>\n<p>\u0130lgili entegrasyonlardan sonra uygulamay\u0131 yeniden derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131zda hatalar\u0131n ortadan kalkt\u0131\u011f\u0131 g\u00f6r\u00fclecektir ve uygulama a\u015fa\u011f\u0131daki gibi bir ekranla bizleri kar\u015f\u0131layacakt\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2.png\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"1805\" height=\"335\" class=\"aligncenter size-full wp-image-9883\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2.png 1805w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2-300x56.png 300w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2-768x143.png 768w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2-1024x190.png 1024w\" sizes=\"auto, (max-width: 1805px) 100vw, 1805px\" \/><\/a><\/p>\n<p>Yukar\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnden de anla\u015f\u0131ld\u0131\u011f\u0131 \u00fczere Smart Table varsay\u0131lan olarak &#8220;Add New&#8221;, &#8220;Edit&#8221; ve &#8220;Delete&#8221; aksiyonlar\u0131n\u0131 bar\u0131nd\u0131rmakta ve her bir kolona \u00f6zel filtreleme mekanizmas\u0131yla devreye girmektedir. Ayr\u0131ca kolonlar\u0131n headerlar\u0131na t\u0131kland\u0131\u011f\u0131 zaman bir s\u0131ralama \u00f6zelli\u011fide bar\u0131nd\u0131rmaktad\u0131r. <\/p>\n<h3><span style=\"color: #800080;\">Genel Ayarlar\u0131<\/span><\/h3>\n<p>Smart Table componentinin varsay\u0131lan olarak gelen \u00f6zellikleri \u00fczerinde a\u015fa\u011f\u0131daki gibi de\u011fi\u015fiklikler ger\u00e7ekle\u015ftirebiliriz.<\/p>\n<ul>\n<li>\n<strong>actions<\/strong><br \/>\nVarsay\u0131lan olarak gelen &#8220;Add New&#8221;, &#8220;Edit&#8221; ve &#8220;Delete&#8221; actionlar\u0131 aktif ya da pasif olarak ayarlamam\u0131z\u0131 sa\u011flayan bir \u00f6zelliktir. Dolay\u0131s\u0131yla bu \u00f6zelli\u011fin varsay\u0131lan de\u011feri de &#8220;true&#8221; de\u011feridir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      .\r\n      .\r\n      .\r\n    },\r\n    actions: {\r\n      add: true,\r\n      delete: true,\r\n      edit: true\r\n    }\r\n  };\r\n<\/pre>\n<\/li>\n<li>\n<strong>delete<\/strong><br \/>\nVarsay\u0131lan olarak gelen &#8220;Delete&#8221; action&#8217;\u0131na \u00f6zel ayarlar\u0131 yapmam\u0131z\u0131 sa\u011flayan \u00f6zelliktir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    delete: {\r\n      confirmDelete: true,\r\n      deleteButtonContent: 'Sil',\r\n      saveButtonContent: 'Kaydet',\r\n      cancelButtonContent: '\u0130ptal'\r\n    },\r\n    columns: {\r\n      .\r\n      .\r\n      .\r\n    }\r\n  };\r\n<\/pre>\n<p>Bu yap\u0131land\u0131rmada, silme i\u015flemi tetiklendi\u011fi anda kullan\u0131lacak fonksiyonuda &#8220;ng2-smart-table&#8221; nesnesine a\u015fa\u011f\u0131daki gibi tan\u0131mlayabiliriz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;ng2-smart-table &#x5B;settings]=&quot;settings&quot; &#x5B; source]=&quot;data&quot; (deleteConfirm)=&quot;onDeleteConfirm($event)&quot;&gt;&lt;\/ng2-smart-table&gt;\r\n<\/pre>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  onDeleteConfirm(event) {\r\n    alert(`${event.data.adi} ${event.data.soyAdi} siliniyor....`);\r\n  }\r\n<\/pre>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-9886\" \/><\/a>\n<\/li>\n<li>\n<strong>add<\/strong><br \/>\nVarsay\u0131lan olarak gelen &#8220;Add&#8221; action&#8217;\u0131na \u00f6zel ayarlar\u0131 yapmam\u0131z\u0131 sa\u011flayan \u00f6zelliktir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    add: {\r\n      confirmCreate: true,\r\n      createButtonContent: 'Ekle',\r\n      saveButtonContent: 'Kaydet',\r\n      cancelButtonContent: '\u0130ptal'\r\n    },\r\n    columns: {\r\n      .\r\n      .\r\n      .\r\n    }\r\n  };\r\n<\/pre>\n<p>\u00d6zelli\u011fin ili\u015fkilendirilece\u011fi fonksiyon i\u00e7in;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;ng2-smart-table &#x5B;settings]=&quot;settings&quot; &#x5B; source]=&quot;data&quot; (createConfirm)=&quot;onCreateConfirm($event)&quot;&gt;&lt;\/ng2-smart-table&gt;\r\n<\/pre>\n<p>olay\u0131n\u0131 tan\u0131mlamam\u0131z yeterlidir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  onCreateConfirm(event) {\r\n    alert(`${event.newData.adi} ${event.newData.soyAdi} ekleniyor.`);\r\n  }\r\n<\/pre>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-1.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-9893\" \/><\/a>\n<\/li>\n<li>\n<strong>edit<\/strong><br \/>\nVarsay\u0131lan olarak gelen &#8220;Edit&#8221; action\u2019\u0131na \u00f6zel ayarlar\u0131 yapmam\u0131z\u0131 sa\u011flayan \u00f6zelliktir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    edit: {\r\n      confirmSave: true,\r\n      editButtonContent: 'D\u00fczenle',\r\n      saveButtonContent: 'Kaydet',\r\n      cancelButtonContent: '\u0130ptal'\r\n    },\r\n    columns: {\r\n      .\r\n      .\r\n      .\r\n    }\r\n  };\r\n<\/pre>\n<p>\u00d6zelli\u011fin ili\u015fkilendirilece\u011fi fonksiyon i\u00e7in;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;ng2-smart-table &#x5B;settings]=&quot;settings&quot; &#x5B; source]=&quot;data&quot; (editConfirm)=&quot;onSaveConfirm($event)&quot;&gt;&lt;\/ng2-smart-table&gt;\r\n<\/pre>\n<p>olay\u0131n\u0131 tan\u0131mlamam\u0131z yeterlidir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  onSaveConfirm(event) {\r\n    alert(`${event.data.adi} ${event.data.soyAdi} de\u011feri ${event.newData.adi} ${event.newData.soyAdi} olarak g\u00fcncelleniyor.`);\r\n  }\r\n<\/pre>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-2.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"600\" height=\"200\" class=\"aligncenter size-full wp-image-9895\" \/><\/a>\n<\/li>\n<li>\n<strong>attr<\/strong><br \/>\nRender edilecek tabloya class, id vs. gibi attributelar verebilmemizi sa\u011flayan \u00f6zelliktir.\n<\/li>\n<\/ul>\n<h3><span style=\"color: #800080;\">Kolonlara Farkl\u0131 \u00d6zellikler Verme<\/span><\/h3>\n<p>Smart Table componentinde, verileri listelerken kolonlar \u00fczerinde filtreleme, s\u0131ralama vs. gibi ayarlar yapabilmemizi sa\u011flayan &#8220;title&#8221;, &#8220;type&#8221;, &#8220;renderComponent&#8221;, &#8220;filter&#8221;, &#8220;width&#8221; ve &#8220;sort&#8221; \u00f6zel alanlar\u0131 mevcuttur.<\/p>\n<ul>\n<li>\n<strong>title<\/strong> : Kolon ad\u0131n\u0131 tutar.\n<\/li>\n<li>\n<strong>type<\/strong> : Kolon tipini tutar. \u0130\u015flevsel olarak \u00f6zel tasarlad\u0131\u011f\u0131m\u0131z <span style=\"font-size:9px;\">(ileri sat\u0131rlarda g\u00f6rece\u011fiz)<\/span> kolonlar\u0131 kullanabilmek i\u00e7in varsay\u0131lan de\u011ferin d\u0131\u015f\u0131nda &#8220;custom&#8221; de\u011ferini alabilir.\n<\/li>\n<li>\n<strong>renderComponent<\/strong> : \u00d6zel tasarlanan kolonlar\u0131 render edebilmek i\u00e7in set edebilece\u011fimiz aland\u0131r. Bu alan\u0131n kullan\u0131labilmesi i\u00e7in &#8220;type&#8221; alan\u0131n\u0131n &#8220;custom&#8221; de\u011ferini almas\u0131 gerekmektedir.\n<\/li>\n<li>\n<strong>filter<\/strong> : Kolonun filtreleme \u00f6zelli\u011fini ayarlamaktad\u0131r. &#8220;true&#8221; ya da &#8220;false&#8221; de\u011feri al\u0131r.\n<\/li>\n<li>\n<strong>sort<\/strong> : S\u0131ralama \u00f6zelli\u011fini ayarlamaktad\u0131r.\n<\/li>\n<li>\n<strong>width<\/strong> : \u0130lgili kolonun geni\u015fli\u011fini ayarlamaktad\u0131r.\n<\/li>\n<li>\n<strong>valuePrepareFunction<\/strong> : \u0130lgili kolondaki her bir sat\u0131ra ait de\u011fer \u00fczerinde i\u015flem yapmam\u0131z\u0131 sa\u011flayan bir fonksiyondur.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131',\r\n        valuePrepareFunction: (value) =&gt; { return value === &quot;Gen\u00e7ay&quot; ? 'true' : 'false' }\r\n      }\r\n    }\r\n  };\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer t\u00fcm sat\u0131rlarda de\u011feri &#8220;Gen\u00e7ay&#8221; olan\u0131n yerine &#8220;true&#8221;, di\u011ferlerinin yerine &#8220;false&#8221; de\u011feri yazd\u0131r\u0131lmaktad\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3.png\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"145\" height=\"323\" class=\"aligncenter size-full wp-image-9905\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3.png 145w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3-135x300.png 135w\" sizes=\"auto, (max-width: 145px) 100vw, 145px\" \/><\/a><\/p>\n<p>Ya da,<\/p>\n<p>Sat\u0131ra ba\u011fl\u0131 olan nesneyi ve ilgili h\u00fccreleri temsil edecek a\u015fa\u011f\u0131daki gibi bir fonksiyonda tan\u0131mlanabilir.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131',\r\n        valuePrepareFunction: (cell, row) =&gt; { return `${row.adi} ${row.soyAdi}`; }\r\n      }\r\n    }\r\n  };\r\n<\/pre>\n<p>Burada &#8220;cell&#8221; o anda bulunulan sat\u0131rdaki de\u011feri getirirken, &#8220;row&#8221; o sat\u0131ra ba\u011fl\u0131 olan nesneyi getirmektedir.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4.png\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"152\" height=\"310\" class=\"aligncenter size-full wp-image-9910\" srcset=\"https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4.png 152w, https:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4-147x300.png 147w\" sizes=\"auto, (max-width: 152px) 100vw, 152px\" \/><\/a>\n<\/li>\n<\/ul>\n<h3><span style=\"color: #800080;\">Custom Kolon Olu\u015fturma<\/span><\/h3>\n<p>Smart Table, \u00f6zel ihtiya\u00e7lar\u0131m\u0131za istinaden custom kolonlar olu\u015fturmam\u0131z\u0131 ve kullanmam\u0131z\u0131 destekleyen bir \u00f6zelli\u011fe sahiptir. Yap\u0131sal olarak herbir custom kolon birer component \u00f6zelli\u011fi te\u015fkil etmektedir. \u015e\u00f6yle ki;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { Component, OnInit } from '@angular\/core';\r\nimport { ViewCell } from 'ng2-smart-table';\r\nimport { Ogrenci } from 'src\/app\/entities\/ogrenci';\r\n\r\n@Component({\r\n  selector: 'app-customcolumn',\r\n  template: '&lt;button (click)=&quot;ogrenciBilgileri()&quot;&gt;\u00d6\u011frenciyi G\u00f6ster&lt;\/button&gt;'\r\n})\r\nexport class CustomColumnComponent implements ViewCell {\r\n  value: string | number;\r\n  rowData: Ogrenci;\r\n\r\n  constructor() { }\r\n  ogrenciBilgileri() {\r\n    alert(`${this.rowData.adi} ${this.rowData.soyAdi}`);\r\n  }\r\n}\r\n<\/pre>\n<p>Yukar\u0131daki kod blo\u011funu incelerseniz e\u011fer &#8220;CustomColumnComponent&#8221; ad\u0131nda bir \u00f6zel kolon olu\u015fturmu\u015f bulunmaktay\u0131z. Smart Table&#8217;da \u00f6zel kolonlar &#8220;ViewCell&#8221; interface&#8217;inden t\u00fcremektedirler. \u0130lgili interface neticesinde implement edilen &#8220;value&#8221; ve &#8220;rowData&#8221; de\u011fi\u015fkenleri ilgili kolona ait sat\u0131rlar\u0131n verilerine eri\u015fmemizi sa\u011flayan de\u011ferleri getirmektedirler. &#8220;value&#8221; h\u00fccrede bulunan de\u011feri getirirken, &#8220;rowData&#8221; ilgili sat\u0131ra ba\u011fl\u0131 olan nesneyi getirmektedir. Burada g\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere \u00f6zel kolon \u00f6zelli\u011fi te\u015fkil edecek olan componentimiz bir &#8220;button&#8221; nesnesi basmaktad\u0131r ve butona t\u0131kland\u0131\u011f\u0131nda \u00f6\u011frenci bilgileri getirecek olan fonksiyonu tetiklemektedir.<\/p>\n<p>Olu\u015fturmu\u015f oldu\u011fumuz bu custom kolonu kullanabilmek i\u00e7in(<span style=\"font-size:10px;\">ilgili kolonda<\/span>) &#8220;type&#8221; \u00f6zelli\u011fine &#8220;custom&#8221; de\u011ferini vermeli ve &#8220;renderComponent&#8221; \u00f6zelli\u011fine bu componentimizi set etmeliyiz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131',\r\n        filter: false\r\n      },\r\n      id: {\r\n        title: &quot;\u0130\u015flemler&quot;,\r\n        type: &quot;custom&quot;,\r\n        filter: false,\r\n        renderComponent: CustomColumnComponent\r\n      }\r\n    }\r\n  };\r\n<\/pre>\n<p>Bu i\u015flem neticesinde art\u0131k bu kolon \u00f6zel olarak tasarlad\u0131\u011f\u0131m\u0131z kolon tipinden olacakt\u0131r. Lakin uygulamay\u0131 derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131zda hata ile kar\u015f\u0131la\u015faca\u011f\u0131z. Nihayetinde bu yapt\u0131\u011f\u0131m\u0131z \u00e7al\u0131\u015fma her ne kadar bir custom column uygulamas\u0131 olsada en nihayetinde bir component olu\u015fturmu\u015f bulunmaktay\u0131z ve bu componenti ana mod\u00fcl\u00fcm\u00fczde ilgili birimlere bildirmek mecburiyetindeyiz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { BrowserModule } from '@angular\/platform-browser';\r\nimport { NgModule } from '@angular\/core';\r\n\r\nimport { AppComponent } from '.\/app.component';\r\nimport { Ng2SmartTableModule } from 'ng2-smart-table';\r\nimport { CustomColumnComponent } from '.\/customColumns\/customcolumn\/custom.column.component';\r\n\r\n@NgModule({\r\n  declarations: &#x5B;\r\n    AppComponent,\r\n    CustomColumnComponent\r\n  ],\r\n  imports: &#x5B;\r\n    BrowserModule,\r\n    Ng2SmartTableModule\r\n  ],\r\n  providers: &#x5B;],\r\n  bootstrap: &#x5B;AppComponent],\r\n  entryComponents: &#x5B;CustomColumnComponent]\r\n})\r\nexport class AppModule { }\r\n<\/pre>\n<p>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere custom column olarak tasarlad\u0131\u011f\u0131m\u0131z componenti, uygulamaya ana mod\u00fcldeki &#8220;declarations&#8221; alan\u0131ndan dahil ettik. Lakin burada dikkat ederseniz \u00f6zel kolonumuz ekstradan &#8220;entryComponents&#8221; isimli bir alanada dahil edilmi\u015f bulunmaktad\u0131r. Smart Table componentinde tasarlanan custom column componentleri &#8220;entryComponents&#8221; alan\u0131na dahil edilmek mecburiyetindedir. Aksi taktirde uygulamadan hata al\u0131nacakt\u0131r.<\/p>\n<p>T\u00fcm bu i\u015flemler neticesinde uygulamay\u0131 derleyip \u00e7al\u0131\u015ft\u0131rd\u0131\u011f\u0131m\u0131zda a\u015fa\u011f\u0131daki ekran g\u00f6r\u00fcnt\u00fcs\u00fcnde oldu\u011fu gibi bir sonu\u00e7la kar\u015f\u0131laca\u015faca\u011f\u0131z.<\/p>\n<p><a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-3.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"528\" height=\"346\" class=\"aligncenter size-full wp-image-9919\" \/><\/a><\/p>\n<h3><span style=\"color: #800080;\">Custom Kolonlarda Event Olu\u015fturma<\/span><\/h3>\n<p>Olu\u015fturulan \u00f6zel kolonlarda ger\u00e7ekle\u015ftirilen t\u00fcm actionlar\u0131 takip edebilmek yahut i\u015flevsel olarak olay tetikleyebilmek i\u00e7in a\u015fa\u011f\u0131daki gibi event olu\u015fturabiliriz.<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { Component, OnInit, EventEmitter, Output } from '@angular\/core';\r\nimport { ViewCell } from 'ng2-smart-table';\r\nimport { Ogrenci } from 'src\/app\/entities\/ogrenci';\r\n\r\n@Component({\r\n  selector: 'app-customcolumn',\r\n  template: '&lt;button (click)=&quot;ogrenciBilgileri()&quot;&gt;\u00d6\u011frenciyi G\u00f6ster&lt;\/button&gt;'\r\n})\r\nexport class CustomColumnComponent implements ViewCell {\r\n  value: string | number;\r\n  rowData: Ogrenci;\r\n\r\n  constructor() { }\r\n\r\n  @Output() event: EventEmitter&lt;any&gt; = new EventEmitter&lt;any&gt;();\r\n  @Output() event2: EventEmitter&lt;any&gt; = new EventEmitter&lt;any&gt;();\r\n  ogrenciBilgileri() {\r\n    this.event.emit({ rowData: this.rowData, action: &quot;1. Olay&quot; });\r\n    this.event2.emit({ rowData: this.rowData, action: &quot;2. Olay&quot; });\r\n  }\r\n}\r\n<\/pre>\n<p>G\u00f6r\u00fcld\u00fc\u011f\u00fc \u00fczere, @Output olarak tan\u0131mlanan &#8220;EventEmitter&#8221; nesnesi ilgili fonksiyon tetiklendi\u011finde emit edilmekte ve olay tetiklenmektedir.<\/p>\n<p>Bu tetiklenen olay\u0131 kar\u015f\u0131layabilmek i\u00e7in ilgili \u00f6zel kolonda;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131',\r\n        filter: false\r\n      },\r\n      id: {\r\n        title: &quot;\u0130\u015flemler&quot;,\r\n        type: &quot;custom&quot;,\r\n        filter: false,\r\n        renderComponent: CustomColumnComponent,\r\n        onComponentInitFunction: (instance) =&gt; {\r\n          instance.event.subscribe(x =&gt; {\r\n            const actionData = x.rowData as Ogrenci;\r\n            alert(`${actionData.adi} ${actionData.soyAdi} | action -&gt; ${x.action}`);\r\n          });\r\n          instance.event2.subscribe(x =&gt; {\r\n            const actionData = x.rowData as Ogrenci;\r\n            alert(`${actionData.adi} ${actionData.soyAdi} | action -&gt; ${x.action}`);\r\n          });\r\n        }\r\n      }\r\n    }\r\n  };\r\n<\/pre>\n<p>\u00e7al\u0131\u015fmas\u0131n\u0131 yapmam\u0131z yeterlidir.<\/p>\n<p>&#8220;onComponentInitFunction&#8221; alan\u0131na tan\u0131mlanan fonksiyon, \u00f6zel olarak tasarlanan kolonlarda tan\u0131mlanan eventlara abone olmakta ve &#8220;instance&#8221; parametresiyle herhangi bir tetikleme s\u00f6z konusu olursa yakalamaktad\u0131r.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-4.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"528\" height=\"346\" class=\"aligncenter size-full wp-image-9925\" \/><\/a><\/p>\n<h3><span style=\"color: #800080;\">LocalDataSource Nesnesi<\/span><\/h3>\n<p>LocalDataSource nesnesi, Smart Table componentinde veri kayna\u011f\u0131 ile component aras\u0131ndaki ili\u015fkiyi daha detayl\u0131 y\u00f6netmemizi sa\u011flayan bir veri kontrol nesnesidir. Kullan\u0131m\u0131 a\u015fa\u011f\u0131daki gibidir;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nimport { Component, OnInit } from '@angular\/core';\r\nimport { OkulService } from '.\/services\/okul.service';\r\nimport { Ogrenci, ogrenciler } from '.\/entities\/ogrenci';\r\nimport { LocalDataSource } from 'ng2-smart-table';\r\nimport { CustomColumnComponent } from '.\/customColumns\/customcolumn\/custom.column.component';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: '.\/app.component.html',\r\n  styleUrls: &#x5B;'.\/app.component.css']\r\n})\r\nexport class AppComponent implements OnInit {\r\n\r\n  constructor(private okulService: OkulService) { }\r\n\r\n  settings = {\r\n    columns: {\r\n      adi: {\r\n        title: 'Ad\u0131'\r\n      },\r\n      soyAdi: {\r\n        title: &quot;Soyad\u0131&quot;\r\n      },\r\n      sinif: {\r\n        title: &quot;S\u0131n\u0131f&quot;\r\n      },\r\n      cinsiyet: {\r\n        title: &quot;Cinsiyet&quot;,\r\n        valuePrepareFunction: (value) =&gt; value === true ? &quot;Erkek&quot; : &quot;Kad\u0131n&quot;\r\n      }\r\n    },\r\n    actions: {\r\n      add: false,\r\n      delete: false,\r\n      edit: false\r\n    }\r\n  };\r\n\r\n  guncelle() {\r\n    debugger;\r\n    this.okulService.add({\r\n      id: 6,\r\n      adi: 'Muiddin',\r\n      soyAdi: '\u0130mpatrino',\r\n      cinsiyet: true,\r\n      sinif: 7\r\n    });\r\n    this.okulService.add({\r\n      id: 7,\r\n      adi: 'Miss',\r\n      soyAdi: 'Merple',\r\n      cinsiyet: false,\r\n      sinif: 8\r\n    });\r\n    this.source.load(this.okulService.get());\r\n  }\r\n\r\n  source: LocalDataSource = new LocalDataSource(this.okulService.get());\r\n\r\n  ngOnInit(): void {\r\n    this.okulService.add({\r\n      id: 1,\r\n      adi: 'Gen\u00e7ay',\r\n      soyAdi: 'Y\u0131ld\u0131z',\r\n      cinsiyet: true,\r\n      sinif: 4\r\n    });\r\n    this.okulService.add({\r\n      id: 2,\r\n      adi: 'Nevin',\r\n      soyAdi: 'Y\u0131ld\u0131z',\r\n      cinsiyet: false,\r\n      sinif: 3\r\n    });\r\n    this.okulService.add({\r\n      id: 3,\r\n      adi: 'Olcay',\r\n      soyAdi: 'G\u00fcdek',\r\n      cinsiyet: true,\r\n      sinif: 5\r\n    });\r\n    this.okulService.add({\r\n      id: 4,\r\n      adi: 'Hakan',\r\n      soyAdi: 'Sabuncu',\r\n      cinsiyet: true,\r\n      sinif: 2\r\n    });\r\n    this.okulService.add({\r\n      id: 5,\r\n      adi: 'Leyla',\r\n      soyAdi: 'Song\u00fcl',\r\n      cinsiyet: false,\r\n      sinif: 3\r\n    });\r\n  }\r\n}\r\n<\/pre>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n&lt;ng2-smart-table &#x5B;settings]=&quot;settings&quot; &#x5B;source]=&quot;source&quot;&gt;&lt;\/ng2-smart-table&gt;\r\n\r\n&lt;button (click)=&quot;guncelle()&quot;&gt;G\u00fcncelle&lt;\/button&gt;\r\n<\/pre>\n<p>Veri kayna\u011f\u0131 \u00fczerinde olan t\u00fcm de\u011fi\u015fiklikleri &#8220;load&#8221; metodu ile listeye an\u0131nda yans\u0131tma imkan\u0131 mevcuttur.<br \/>\n<a href=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-5.gif\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.gencayyildiz.com\/blog\/wp-content\/uploads\/2018\/11\/Angular-Adan-Zye-Smart-Table-Component-Kullan\u0131m\u0131-5.gif\" alt=\"Angular - A&#039;dan Z&#039;ye Smart Table Component Kullan\u0131m\u0131\" width=\"600\" height=\"447\" class=\"aligncenter size-full wp-image-9930\" \/><\/a><\/p>\n<p>Evet&#8230; Yaz\u0131p anlatmas\u0131, okuyup anlamas\u0131 zor olan bir u\u011fra\u015f neticesine gelmi\u015f bulunmaktay\u0131z. Angular uygulamalar\u0131nda tablo i\u015flemlerinde bizlere e\u015flik eden bu \u00e7ok fonksiyonlu componentin t\u00fcm \u00f6zelliklerini ve kullan\u0131m \u015feklini a&#8217;dan z&#8217;ye sizlere eksiksiz anlatmaya \u00e7al\u0131\u015ft\u0131m.<\/p>\n<p>Zahmet edip, okudu\u011funuz i\u00e7in te\u015fekk\u00fcr ederim.<\/p>\n<p>\u0130lgilenenlerin faydalanmas\u0131 dile\u011fiyle&#8230;<\/p>\n<p>Sonraki yaz\u0131lar\u0131mda g\u00f6r\u00fc\u015fmek \u00fczere&#8230;<br \/>\n\u0130yi \u00e7al\u0131\u015fmalar&#8230;<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Merhaba, Bu i\u00e7eri\u011fimizde Angular uygulamalar\u0131nda ak\u0131ll\u0131 tablo yap\u0131s\u0131 olan Smart Table componentini a&#8217;dan z&#8217;ye t\u00fcm \u00f6zellikleriyle ele alacak ve nas\u0131l kullan\u0131ld\u0131\u011f\u0131n\u0131 inceleyece\u011fiz. \u0130lgilenenler bilir ki, Angular mimarisinde kullan\u0131lmak \u00fczere in\u015fa edilmi\u015f birden fazla tablo&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":9930,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2420,2144,2415,2599],"tags":[2691,2692,2698,2700,2701,2694,2695,2696,2690,2693,2697,2699],"class_list":["post-9858","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular","category-angular-4","category-angular-5","category-angular-6","tag-angular-smart-table","tag-angular-smart-table-component","tag-eventemitter","tag-localdatasource","tag-localdatasource-nesnesi","tag-ng2-completer","tag-rxjs","tag-rxjs-compat","tag-smart-table","tag-smart-table-component","tag-smart-table-custom-column","tag-smart-table-event"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/9858","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/comments?post=9858"}],"version-history":[{"count":61,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/9858\/revisions"}],"predecessor-version":[{"id":9932,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/posts\/9858\/revisions\/9932"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media\/9930"}],"wp:attachment":[{"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/media?parent=9858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/categories?post=9858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gencayyildiz.com\/blog\/wp-json\/wp\/v2\/tags?post=9858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}