mazdik / ng-mazdik

Angular UI component library
https://mazdik.github.io/ng-mazdik
MIT License
89 stars 34 forks source link

Propagating live updates #26

Open luigicesena opened 5 years ago

luigicesena commented 5 years ago

Hello, I opened this new one to not go off-topic on the other post. I was trying the live demo updates, and it's working, my list of items is updated every 2 seconds. But I noticed that the updated data is not propagated inside the Update item form, I bounced back and forth between functions but I'm not sure what to do. The problem is that my items are updated every 2 seconds, but when I open the Update form to update an item, I want the form input values to update every 2 seconds too. What would you suggest? I don't want to mess the code badly

mazdik commented 5 years ago

when you open the edit form window:

  updateAction(row: Row) {
    this.dataManager.item = row;
    this.modalEditForm.isNewItem = false;
    this.modalEditForm.detailView = false;
    this.modalEditForm.open();
  }

you can try something like:

this.dataManager.item = null;
this.dataManager.item = selectedNewRow...;

I do not recommend updating the form as often. You can create your custom component (wrapper with override, inheritance)