valor-software / ng2-table

Simple table extension with sorting, filtering, paging... for Angular2 apps
http://valor-software.github.io/ng2-table/
MIT License
554 stars 336 forks source link

Alert cell value changed #577

Open passa9 opened 7 years ago

passa9 commented 7 years ago

Hi all! I'm using ng2-table for show real time data stored on firebase database. This is an example of json stored in database:

{  
   "products":{  
      "-KsP58_NxxXbORQWCbYV":{  
         "brand":"Logitech",
         "category":"mouse",
         "name":"G502",
         "onSale":"27-08-2017 14:30:00",
         "prices":{  
            "-KsP58cmzO1IKtQ_78qf":{  
               "timestamp":"27-08-2017 14:35:00",
               "price":"56.55"
            },
            "-KsP58cmzO1IKtQ_78qg":{  
               "timestamp":"28-08-2017 14:35:00",
               "price":"55.55"
            }
         }
      },
      "-KsP58_NxxXbORQWCbYZ":{  
         "brand":"HP",
         "category":"mouse",
         "name":"X900",
         "onSale":"25-08-2017 10:30:00",
         "prices":{  
            "-KsP58cmzO1IKtQ_78qo":{  
               "timestamp":"25-08-2017 11:30:00",
               "price":"5.22"
            },
            "-KsP58cmzO1IKtQ_78qp":{  
               "timestamp":"25-08-2017 18:30:00",
               "price":"6.22"
            }
         }
      }
   }
}

and this is my code for load into ng2-table:

 private data: Array<Products>;

  public constructor(db: AngularFireDatabase) {

    db.list('products').subscribe(x => {
      this.data = x;
      this.length = this.data.length;
      this.onChangeTable(this.config);
    });

  }

How can I notify the change price value on cell with for example arrow up or arrow down? Thanks in advance!