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
Vue components inside cell? #129
Comments
Hey @bbbford, it's a nice feature to have. |
Thanks @revolist. How would one create a column with some action buttons and handle the click events? |
@bbbford hey, what exactly are you referring to? https://revolist.github.io/revogrid/guide/column.customHeader.html
|
Thank you @revolist! That was what I needed to get going. |
@bbbford , just in case you still consider vue: Still it's recommended to stick with classic approach for better performance. |
Thank you @revolist ! |
@revolist I continue to struggle implementing vue components into the grid. Even your example here fails to compile - https://github.com/revolist/vue-datagrid/releases/tag/v1.2.1 However, what I am really trying to accomplish is to use components from Element UI as my Cell Editor. For example, I want to use this date picker when editing a date cell - https://element.eleme.io/#/en-US/component/date-picker Any guidance on how I could accomplish this? |
@bbbford ,
|
I have looked at the column date plugin, but am left confused. I will study it some more. It would be nice to be able to use any vue component as custom editor, without having to create a plugin, like so -
|
Are you using typescript? |
@bbbford about Vue component in cells. I have created a sample for you here: |
@revolist Thank you for this. I really appreciate your willingness to help! I was able to render my vue component as a cellTemplate. Can the same concept be applied to render a vue component as a cell Editor? Attempting to do so, like this, results in TypeError: https://codesandbox.io/s/revogrid-vuecomponent-forked-5xlrs?file=/src/App.vue |
@bbbford in order to create an editor you have to follow rules specified in https://revolist.github.io/revogrid/guide/cell.editor.html We'll provide a common adapter for editors in the nearest future, I have created a draft for you which you can use for your purposes. Just copy the whole editorAdapter.js as it is. https://codesandbox.io/s/revogrid-vueeditor-bxpq0?file=/src/App.vue |
@revolist Brilliant! I'm well on my way now... thanks you!! |
Hey guys, I read all this topic, and while I was thinking of opening an issue, I believe this fits here. |
You can do this, check the documentation. https://revolist.github.io/revogrid/guide/framework.vue.component.html |
Ah sorry. I actually just removed the comment since I realized it is in the documentation. Thanks for the swift reply! |
@bbbford While I got the component to import, and added to columns, it gives an error looks like same as @Tadeu17 has reported. Component fails to work using cellTemplate.
Button.vue
|
For faster reply please provide a sample in online editor, you can fork our sample https://codesandbox.io/embed/data-vue-test-3wkzi?file=/src/App.vue&codemirror=1 |
@revolist Here, quickly copied the code I provided above, same results on this isolated sandbox. |
@timothymarois I see your problem. Initially vue-component template was built with idea of typescript support. Hence to make it work correctly you have to return Vue instance as component, not just structure. https://codesandbox.io/s/sleepy-colden-7c468?file=/src/Button.vue
|
@timothymarois starting from version 2.9.8 you can pass as structure as well: |
Hi @revolist , thanks for all the clear instructions here. My code is organised like yours in this example, where the I could use a Vuex getter with the prop & rowIndex to look that up in the custom component, but I wonder if that will affect performance when I have many rows? |
👆🏽 I figured this out by looking at the Editor example. In addition to The |
Is it possible to translate this code to use react component instead of vue components? |
How could one use a Vue component inside of a cell?
For example, I'd like to put an element-ui button in there for edit/delete/etc. I'd need be able to handle the click event.
I'd also like to use a datepicker component.
This does not seem obvious to me using the cell renderer.
Thanks for all the hard work on this great component!
The text was updated successfully, but these errors were encountered: