• Ivy Seo

ngx-datatable ver. 2

There are several ways to display data in ngx-datatable.

How is how I created a data table using <tr>, <th>, <td> tags:

component.html file:

 <th *ngFor="let col of columns" style="border-collapse: collapse !important;   text-align: left !important;  border-bottom: 1px solid #ddd !important;">
 <tr *ngFor="let row of rows" style="border-collapse: collapse !important;   text-align: left !important;">
 <td *ngFor="let col of columns" style= "border-bottom: 1px solid #ddd !important;">

component.ts file:

 export class FilterBarComponent implements OnInit {

 constructor(private http: HttpClient){}    

 ngOnInit() {

 columns = [
      { name: 'logdate' },   
      { name: 'direction' },
      { name: 'latend' },
      { name: 'lathemi' },
      { name: 'lonend' },
      { name: 'lonhemi' },
      { name: 'mph' },
      { name: 'county' },
      { name: 'road' },
      { name: 'linetype' }

 rows = [];
 @ViewChild(DatatableComponent) table: DatatableComponent;

 // get m7 log  data from back-end and insert its data into the row of the table
 get_m7log_data() {  
      .subscribe(data => {    // data returned
 let data_check: any = data; // set as 'any'
 this.rows = data_check; // returned data => rows []


Recent Posts

See All

Generate unique filename: UUID, Path

A: using UUID let my_uuid = Uuid::new_v4(); let file_created = File::create(my_uuid.to_string()).expect("create file failed");     println!("uuid: {}", my_uuid); //  buffer write let mut file_ge

JSON - write .txt file in Rust

pub fn serialize_writeFile(data : &full_data ) -> Result<bool, modbus::Error> { // 1) takes data  // this function takes the m7_data object and serializes the contents and saves the results to a text

Serialize/Deserialize JSON in Rust

This README has some good examples. To deserialize in Rust: use serde::{Deserialize, Serialize}; use serde_json::Result; #[derive(Serialize, Deserialize)] struct Person {     name: String,     age: u