Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit mode #357

Open
z6aak opened this issue Mar 8, 2017 · 5 comments
Open

Edit mode #357

z6aak opened this issue Mar 8, 2017 · 5 comments

Comments

@z6aak
Copy link

z6aak commented Mar 8, 2017

To start with thanks for the awesome addon.
I'm presenting a table for users, where all data on each row has to be editable. What I was trying to do is, when a button (table action) is clicked, then all the cells in the row should be input fields. So basically I want to render different component.
I can not find anything that supports this. How would I go about it? I'm new to Ember :)

@alexander-alvarez
Copy link
Collaborator

@z6aak you'll need to override cellComponent on your columns to do custom behavior.

In your case it will detect if the row is "selected" and if it is, then it will render an input, otherwise just text.

see:
https://github.com/offirgolan/ember-light-table/blob/master/addon/templates/components/cells/base.hbs#L2
https://github.com/offirgolan/ember-light-table/blob/e656b333/addon/classes/Table.js#L64

the rows have a .selected property you can leverage assuming you've set canSelect on t.body

@z6aak
Copy link
Author

z6aak commented Mar 8, 2017

Great, I will try that out and let know how far I get with it. Thanks :)

@z6aak
Copy link
Author

z6aak commented Mar 9, 2017

Overriding cellcomponent does the job. I use own isEditing instead of setting canSelect, because when the input is displayed and I click in it, the select is toggled :)
But say I wanted to have a form around my row when editing so that I for example support submit on Enter etc. out of the box. Have any ideas on this?

@alexander-alvarez
Copy link
Collaborator

@z6aak
Copy link
Author

z6aak commented Mar 10, 2017

Then the form tag will be inside a table, right. I need to put entire table into a form.
But I should be able to make a key binding on Enter and problem solved for now.
Maybe it would still be good to have a editmode with this addon. So that the row is turned into a form when it's being edited.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants