andrewcourtice / vuetiful

Vuetiful is a component framework written on top of the Vue reactive library. It is primarily designed for creating business/administration applications where the displaying of data is paramount.
MIT License
488 stars 108 forks source link

External grouping #6

Closed manik005 closed 7 years ago

manik005 commented 7 years ago

Hi Andrew, First I would like to appreciate you for the great work so far. I was just trying to play with it and decided to have grouping functionality externally. ie group based on the toggle component's state. I was trying to access the groupColumn method from the parent instance but not sure why it is getting triggerd. What would be the best way to acheive it ?

manik005 commented 7 years ago

Sorry for the trouble. There was some problem with me ref, just now figured it out. Is there any other method we can access child components ?

andrewcourtice commented 7 years ago

Hi @manik005

Thank you for the feedback. I hope you continue to find the framework useful.

I'm not sure I understand your question correctly. Are you wanting to access child components from the parent datatable or are you wanting to call methods on the datatable from some other component?

Thanks Andrew

manik005 commented 7 years ago

Actually 'm trying both.

On Tue 28 Feb, 2017, 5:08 AM Andrew Courtice, notifications@github.com wrote:

Hi @manik005 https://github.com/manik005

Thank you for the feedback. I hope you continue to find the framework useful.

I'm not sure I understand your question correctly. Are you wanting to access child components from the parent datatable or are you wanting to call methods on the datatable from some other component?

Thanks Andrew

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/andrewcourtice/vuetiful/issues/6#issuecomment-282893618, or mute the thread https://github.com/notifications/unsubscribe-auth/AAn_tuWjPivJZSBO0KCW39LE9KR0PJunks5rg16LgaJpZM4ML_QC .

yosokus commented 7 years ago

hi @andrewcourtice , thank you for creating a wonderful pluign. It is really appreciated. I was wondering, can I specify a default grouping when initializing a table? I would like to initialize a table with 2 level grouping. I tried using the grouping-column-ids option but it is not working. I'm I doing this wrong?

manik005 commented 7 years ago

hey @yosokus , I tried something similar to this initially. What I did was first gave a ref to the datatable and then passed the index of column to be grouped to the groupColumn method of datatable. Have mentioned the code snippet below

this.$refs.refOfDatatable.groupColumn(this.columns[indexOfColumnToBeGrouped]);

ps: 'm newbie to vuejs so 'm not really sure if this is a correct but it works.

yosokus commented 7 years ago

@manik005 thanks. I'll try it. I'm also a newbie to vue.js, so who am I to judge

andrewcourtice commented 7 years ago

Hi @yosokus

Firstly, thank you for your feedback. I appreciate it.

The code snippet @manik005 has provided above is correct. Just create a reference to the datatable component and then you can call the groupColumn and degroupColumn functions respectively to add the column to the grouping stack or remove that column from the grouping stack.