institut-de-genomique / Ultimate-DataTable

This AngularJS directive generate a HTML table with build-in fonctionnality like save, edit, remove, pagination etc...
http://institut-de-genomique.github.io/Ultimate-DataTable/
45 stars 26 forks source link

Sample Usage Request - drag and drop to reorder columns #46

Open educray opened 6 years ago

educray commented 6 years ago

Hi, I managed in configuring a lot of thing with this usefull directive.

It was not hard to fond out how to use functions manage values when we don't want touse directly a property. Was a bit harder to do columne show/hide . Using columnId p+the rank in the columne table and then set it in config.hid.columns this way : feg for column[0], id is "p1" and then : { "p1":true } was ok.

The ultimate would be to be able to :

I you could just help me on this point it would be great.

galbini commented 6 years ago

Hi,

Thank you for your interest of UDT. The column drag and drop is a very old feature test and i don't known if it can be work with the current UDT version.If you want, you can try to add this function and submit a pull request and i will check if all the case are take into account.

Best regards, Guillaume

educray commented 6 years ago

Hi,

Currently I focus on some trouble with feg grouping or sorting when you use a function in column property field. I guess that my first pull request will be something like that. Like I use to say in french : il y a deux écoles. which one would have your preference :

Maybe I'm going totally wrong and this case is already satisfied... then show me the way.

Regards, Edouard

galbini commented 6 years ago

After check, there is a bug when used a function on property with sort and group, i need to solve it.

In waiting, can you replace your function with an angular expression (it's a better way) that will be solved your problem.

You can use the parameter objectsMustBeAddInGetFinalValue:{} //object used in $parse to apply function on extract value. Set the object that contain your function and call it with angular expression.

ydeshayes commented 6 years ago

Hello @educray,

like @galbini said, we had this feature long time ago, before the udt was open sourced.

Here is my code from that time: https://gist.github.com/ydeshayes/e09502c9ec13cf6ba463fae088d0cd27

IIRC you have to add this directive in the column because they will be draggable and droppable. But the udt code change over the last years so it might need some adjustment...

educray commented 6 years ago

Thanks a lot. Adding this ` '

` in the second element of the tempate udt-table.html does the trick. And of course closing it at the end. Just a small fix to prevent hidden columns to be shown after the onDrop and everything will be ok.
educray commented 6 years ago

For what I can read hidden columns are now visible because config.hide deals with column.id and onDrop function calls setColumnConfig wich generate new columnsIds.