Coder Social home page Coder Social logo

Comments (12)

vitalets avatar vitalets commented on May 28, 2024

@christianacca
could you describe a bit the usecase when you need it?

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Of course.

The specific use case I'm targeting is as follows.

  • onshow I have an event handler that sets the state of the particular
    model as being in edit mode
  • onclose would then cancel this editing state

The onaftersave would probably have been sufficient but it seems this hook
only gets called when the user confirms acceptance of their changes.

Christian
On 13 Oct 2013 08:42, "Vitaliy Potapov" [email protected] wrote:

@christianacca https://github.com/christianacca
could you describe a bit the usecase when you need it?


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-26213055
.

from angular-xeditable.

vitalets avatar vitalets commented on May 28, 2024

yes, onaftersave is called only when changes are applied.
I will think about onclose / oncancel callbacks..
But also, didn't you try $visible property of form?
I mean

<a editable-text="user.name" e-form="myform">

Now scope.myform.$visible flag refers to form's state.

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Yeah I did think about that. Infact I used it already in one place in the
code. I'll give some more details once I get in front of the code.

I ended up "pushing the boundaries" I think with x-editable making a master
detail table that allows for adding additional records to the table. I
think this drove the need for having an onclose. Like I say I'll get in
front of the code and let you know.

BTW, excellent job on what you've done so far.

C
On 13 Oct 2013 20:13, "Vitaliy Potapov" [email protected] wrote:

yes, onaftersave is called only when changes are applied.
I will think about onclose / oncancel callbacks..
But also, didn't you try $visible property of form?
I mean

Now scope.myform.$visible flag refers to form's state.


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-26224599
.

from angular-xeditable.

vitalets avatar vitalets commented on May 28, 2024

thank you! :)
For adding new records you may have a look on just released 0.1.5 docs http://vitalets.github.io/angular-xeditable/#editable-row

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Cool. Will look at this tonight.
On 14 Oct 2013 09:47, "Vitaliy Potapov" [email protected] wrote:

thank you! :)
For adding new records you may have a look on just released 0.1.5 docs
http://vitalets.github.io/angular-xeditable/#editable-row


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-26242773
.

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Hi Vitaliy,

Had a look at the example for adding a row. I had already done something similar and then tweaked things to make the behaviour fit how I needed the "grid" to work. For example, I needed an editable table. I also wanted the table to be placed in edit mode as soon as the Add button was clicked. Lastly I needed to be to have the cancel button undo the newly added row.

To make the newly added row be in edit mode I had to to do something that felt a little bit of a hack. I ended up having to defer the call to tableForm.$show until after the new row had been rendered in the DOM. I did this by scheduling the call to $show inside a $timeout.

If you're interested in a working example of this I've updated your example here: [http://jsfiddle.net/christianacca/gpgD4/](http://jsfiddle.net/christianacca/gpgD4/

I still need to explain why I think there's a need for an onclose hook... I'll post that a little later once I've experimented a bit more with $visible.

Christian

from angular-xeditable.

vitalets avatar vitalets commented on May 28, 2024

hi @christianacca
I think creating new row already in edit mode is good idea.
I've updated docs: http://vitalets.github.io/angular-xeditable/#editable-row

To have whole table in edit mode you can also use ng-init directive..

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Nice example - really liked how focus is immediately on the first input in
the newly added row.

Not sure how I could use the ng-init to add a new row to an editable
table
that would achieve the following:

  1. Click on the add row button
  2. New row added to the table
  3. Entire table (including new row) is in edit mode
  4. Focus is immediately on the first input in the newly added row

It would be brilliant if you include a new example or update the existing
editable table example :-) If you stuck for time then maybe just some more
pointers so that I can figure it out myself.

Thanks
Christian

On Tue, Oct 15, 2013 at 8:30 AM, Vitaliy Potapov
[email protected]:

hi @christianacca https://github.com/christianacca
I think creating new row already in edit mode is good idea.
I've updated docs:
http://vitalets.github.io/angular-xeditable/#editable-row

To have whole table in edit mode you can also use ng-init directive..


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-26314220
.

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Hi Vitalets,

About that use case for when onclose (with a isCancel argument). I have changed tact a little so that I have now an editable table row for the master table (for the nested details I'm using an editable table).

Anyway, because an editable row has buttons that I manually define, I can define on ng-click event to hook the form open/close events. So the use case I was going to talk about has gone away for the moment.

I suspect another scenario will pop up and in which case the onclose hook would be useful for those inputs that are not wrapped in a form with buttons that I can hook.

Christian

from angular-xeditable.

vitalets avatar vitalets commented on May 28, 2024

hi @christianacca
yes I think these hooks can be usefull anyway.
I plan to add oncancel - called when form is cancelled and onhide - called when form both saved or cancelled.
I'll reopen the issue to keep it in mind for nest release.

from angular-xeditable.

christianacca avatar christianacca commented on May 28, 2024

Cool!
On 16 Oct 2013 14:12, "Vitaliy Potapov" [email protected] wrote:

hi @christianacca https://github.com/christianacca
yes I think these hooks can be usefull anyway.
I plan to add oncancel - called when form is cancelled and onhide -
called when form both saved or cancelled.
I'll reopen the issue to keep it in mind for nest release.


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-26416106
.

from angular-xeditable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.