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

Let's add an Actions field cell type to DataGrid #433

Closed
darnel-T opened this issue Jul 1, 2021 · 16 comments
Closed

Let's add an Actions field cell type to DataGrid #433

darnel-T opened this issue Jul 1, 2021 · 16 comments
Labels
feature New component features and enhancements

Comments

@darnel-T
Copy link

darnel-T commented Jul 1, 2021

In our application at Telekom we need to eidit, and destroy an object represented by a row in a table.
We really like how the DataGrid operates, but it lacts the capability to add these kind of actions for each row.
We would like to implement something like this:

image

We in our team think that this is a general idea which is very common among applications.
We are more than ready to implement this (with my college @sagi-t), I hope you welcome this contribution! :)

@acstll
Copy link
Collaborator

acstll commented Jul 1, 2021

Hey @darnel-T thanks for opening this!

This sounds good to me :) Please let us discuss it internally with the Scale team —we'll do it asap—, and get back to you.

Do you have an idea already of how you would implement this?

@jano314159
Copy link
Contributor

After defining the column action as a field type we would let the rows array accept a HTMLElement objects.
Just as in the HTML field type without the accordion scale-button.

const fields = [
  {
    type: 'text',
    label: 'Name',
  },
  {
    type: 'actions',
    label: 'Actions',
  },
]; 



const rows = [
"john",
document.createElement("scale-button"),
]

It would be up to the developer to implement the actions part as needed something like this
image

@acstll
Copy link
Collaborator

acstll commented Jul 1, 2021

Perfect. We have to check with design too but we need to wait until next week for that.

Let's keep in touch. Thanks again!

@acstll acstll added the feature New component features and enhancements label Jul 1, 2021
@darnel-T
Copy link
Author

darnel-T commented Jul 1, 2021

Thanks, cant wait! :)

@acstll
Copy link
Collaborator

acstll commented Jul 6, 2021

Hello @darnel-T @sagi-t :)

We are currently having a discussion with the design team regarding whether we should limit what one would be able to put into this new Actions cell type. So instead of having a space where you put could anything —like the current HTML type—, accept something more structured, like an array of items that would represent an action (like an icon and a callback, for instance). The whole point would be making sure we maintain the design language of the system by enforcing only certain elements. Does that make sense?

The implementation would change a bit, but not that much, no?

(I wanted to share also that it seemed clear to us that this addition is aligned with the idea of serving common use cases!)

@darnel-T
Copy link
Author

darnel-T commented Jul 6, 2021

It is a perfect proposition.
Let's do it in a more structured way.
Like this?

const fields = [
  {
    type: 'text',
    label: 'Name',
  },
  {
    type: 'actions',
    label: 'Actions',
  },
]; 



const rows = [
"john",
[
   {
       label: 'Edit',
       icon: 'scale-pencil-icon',
       onClick: handleEditClick
    },
    {
       label: 'Delete',
       icon: 'scale-trash-icon',
       onClick: handleDeleteIcon
    }
]

@acstll
Copy link
Collaborator

acstll commented Jul 6, 2021

That looks good.

We're thankful and pretty much looking forward to your contribution and collaborating together.

@darnel-T
Copy link
Author

darnel-T commented Jul 6, 2021

Cool! Can we start implementing this?
Can we do this the with the structure above?
If so, we will start the implementation!

@acstll
Copy link
Collaborator

acstll commented Jul 6, 2021

Cool! Can we start implementing this?
Can we do this the with the structure above?
If so, we will start the implementation!

yes, please!

Once you have a PR up, we'll review it and we'll work together until it's good to merge.

Again, looking forward to it. Thank you!

@darnel-T
Copy link
Author

darnel-T commented Jul 9, 2021

#444 @sagi-t has finished to PR. Please check it, looking forward to your feedbacks.

Actions field type looks like this:

image

@acstll
Copy link
Collaborator

acstll commented Jul 13, 2021

Thank you very much @sagi-t! :)

I will check it out today (I was off yesterday)

@darnel-T
Copy link
Author

Cool, we are looking forward to your feedback!

@darnel-T
Copy link
Author

Hey @acstll!
Thanks for merging our pull request.
Any estimation when will it be released?
We are looking forward to use this changes in our project :)
Thanks for your help!

@acstll
Copy link
Collaborator

acstll commented Jul 20, 2021

Hey @darnel-T

We couldn't do the release yesterday. Unfortunately there is an issue with a package that makes the release pipeline fail. But we're trying to fix it now and the new beta release will be out right after.

I'll let you know :)

@acstll
Copy link
Collaborator

acstll commented Jul 21, 2021

@darnel-T 3.0.0-beta.16 is out.

I hope it works as expected, let me know if it doesn't.

Thanks for the patience, but mostly for the amazing contribution!

@darnel-T
Copy link
Author

Pretty amazing!
Thanks for this quick journey together.
I hope we can contribute again in the future!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New component features and enhancements
Projects
None yet
Development

No branches or pull requests

3 participants