qontu / ngx-inline-editor

Native UI Inline-editor Angular (4.0+) component
https://qontu.github.io/ngx-inline-editor
MIT License
164 stars 90 forks source link

saveEditable($event) method is getting called every time when clicking anywhere on the screen, after changing the underlying field #104

Open mandeeps1 opened 7 years ago

mandeeps1 commented 7 years ago

saveEditable($event) method is getting called every time when clicking anywhere on the screen, after changing the underlying field. Even clicking on cancel (cross) button calls the saveEditable($event) method. Version: 0.1.1-alpha.20

tonivj5 commented 7 years ago

Hi @mandeeps1, can you provide us a demo? I think https://github.com/qontu/ngx-inline-editor/issues/78 could be related

Thanks! :+1:

mandeeps1 commented 7 years ago

Hi @xxxtonixxx , I will try to create a demo for you soon.

For your reference,

<inline-editor  saveOnBlur="true" type="textarea"
 [(ngModel)]="issueObj.description" (onSave)="saveEditable($event)" id="descr-id"
 size="20" cols="100" rows="15" min="1" placeholder="description">
</inline-editor>
saveEditable(value) {
    console.log('saveEditable...........');
    // call to http server
    this
      ._httpservice
      .postHttpReq(this.editIssueUrl, this.issueObj)
      .subscribe(res => {
          console.log(res[0].json['_body']);
          if (res[0].json['_body'] === 'true') {
            console.log('Issue updated');
          }
        }, error => {
          console.log(error);
        },
        () => console.log('completed'));
  }

If I remove the attribute saveOnBlur="true", then it works fine. But if I remove saveOnBlur="true", then my other editors remains in active state all the time as mentioned in #97 .

tonivj5 commented 7 years ago

Thanks for the references :+1:

I think I undestand your problem. Hmmm, I will investigate it, however I have not time :sweat:

If you want help us, a PR would be awesome :tada:. Anyway, thanks for your interesting and report :smile:

darrendlin commented 6 years ago

Hi, if I'm understanding this issue correctly, this looks like it could be a huge problem if it's actually trying to call the server on every click (after the above processes).

This library looks cool and I want to use it, but if this is still an issue I'm a bit reluctant to break it in...

tonivj5 commented 6 years ago

yeah @darrendlin, it's a huge problem... I will try to fix it next days :+1:

swethaAllam commented 6 years ago

Is this fixed yet?

tonivj5 commented 6 years ago

it's more difficult I thought... I tried to fix it, but I had problems to fix it. Maybe, we will need to rewrite some core parts of component...