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

Improve size of textarea in edit mode #27

Closed Jenselme closed 8 years ago

Jenselme commented 8 years ago

Base the number of rows and columns on the content of the area

galbini commented 8 years ago

Hi Julien,

Thanks for your proposal, I need to study it because the compute of row and column size can be expensive with lots of data.

I think, the better way is to execute this compute only if the developer wants it. For example, you can use editDirectives parameter on column to inject your own custom directives to the row and column compute.

{
  "editDirectives":" ng-compute-rows=true  ng-compute-cols=true"
}

What do you think ?

Best regards, Guillaume

Jenselme commented 8 years ago

the compute of row and column size can be expensive with lots of data.

True

For example, you can use editDirectives parameter on column to inject your own custom directives to the row and column compute.

Seems like a good idea. I'll try to implement that soon.

Jenselme commented 8 years ago

I gave it a look today and I am not sure that I understand what you mean by:

For example, you can use editDirectives parameter on column to inject your own custom directives to the row and column compute. { "editDirectives":" ng-compute-rows=true ng-compute-cols=true" }

When I first read it, it seemed to me that the directives ng-compute-rows and ng-compute-cols already existed. However, I wasn't able to find them on the internet. Did you mean instead that I should create them in UDT?

galbini commented 8 years ago

Julien,

Sorry for the trouble. These directives does not exists, that's just an example of directive names. Yes, you need to create the directives then you can add it in UDT if you want or just keep it in your project.

Best regards, Guillaume

Jenselme commented 8 years ago

Would something like that: https://github.com/institut-de-genomique/Ultimate-DataTable/commit/0740ce63d372f4f7cd196a8991ce186df335f35a be OK for you?

You can use it like that: editDirectives: ' udt-textarea-resize udt-textarea-text="value.data[col.property]" ',

galbini commented 8 years ago

Hi Julien,

Good work. You can improve your directive with the ngModelCtrl property. You can find an example on udt-change directive and see the doc : ngModelController.

With this feature you don't need to have the attribute : udt-textarea-text.

Regards, Guillaume

Jenselme commented 8 years ago

Thanks for the tip! See #29 for the new PR.