swimlane / ngx-datatable

✨ A feature-rich yet lightweight data-table crafted for Angular
http://swimlane.github.io/ngx-datatable/
MIT License
4.63k stars 1.68k forks source link

cell blur in edit mode after typing (keydown) in custom directive #509

Open eliadAyehu opened 7 years ago

eliadAyehu commented 7 years ago

in edit mode, while I put a template inside a cell, the got blur event after keydown.

in the template i use a directive which also catch most of the regular input events.

I already lost few days to try figure it out, but no success.

please help.

I'm submitting a ... (check one with "x")

[X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here

Current behavior blur event pops up after keydown

Expected behavior keep typing in the input custom directive with no blur event pops out.

Reproduction of the problem

What is the motivation / use case for changing the behavior?

Please tell us about your environment: Webstrom.

amcdnl commented 7 years ago

Interesting, this is because https://github.com/swimlane/ngx-datatable/blob/master/src/components/body/body-cell.component.ts#L117 we listen for the blur event of the cell. We probably need to do something like element.contains(target). Can you PR that?

eliadAyehu commented 7 years ago

do you mean remove blur event or do not touch the "isFocused" property ? because it's not helping.

other idea ?

amcdnl commented 7 years ago

Prevent if from being propogated if the event target is inside the cell still.

eliadAyehu commented 7 years ago

I really tried many things. can you please help me with it ?

amcdnl commented 7 years ago

Can you make a demo @eliadAyehu

eliadAyehu commented 7 years ago

no. it's happen in your demo too.

can you please do something with the blur in the cell ?

eliadAyehu commented 7 years ago

i downloaded version 7.0 and the cell still blur after i type.

you just need to add a template with autocomplete and after any keyboard type it gets blur.

what can be the reason for that ?

Adondriel commented 7 years ago

I have a different issue... it seems that the blur on the cell is causing a TON of lag, in my project. This is because 1. The model of each cell is fairly complex to gather, it's not just a simple property... maybe I should look into making the data model more efficient. 2. it redoes everything it did in the blur event, all over again in the click event >.< I am using a slightly different version of "editable grid" where, the entire row becomes editable, when you click it, instead of just 1 cell, because that just looks bad and feels horrible. I will attempt to make this a config option, if I can figure out how... but I may end up just forking and removing the event entirely for now... This is very annoying.