ng-tasty icon indicating copy to clipboard operation
ng-tasty copied to clipboard

Resize columns

Open sharok opened this issue 9 years ago • 5 comments

I think this control doesn't have one important feature. It's a resize columns.

sharok avatar Dec 28 '15 07:12 sharok

Can you explain what you mean about resize columns? Change CSS style? Because you can do that inside the header values http://zizzamia.com/ng-tasty/directive/table/custom-sorting check the javascript code, about the part of

"header": [
    { "key": "name", "name": "Name", "style": {"width": "50%"} },
    { "key": "star", "name": "Star", "style": {"width": "15%"} },
    { "key": "sf-location", "name": "SF Location", "style": {"width": "35%"} }
  ]

Zizzamia avatar Dec 30 '15 02:12 Zizzamia

No, I know this feature. I mean when user can resize by grabbing the column borders and drag them. Like this one http://dobtco.github.io/jquery-resizable-columns @Zizzamia

sharok avatar Dec 30 '15 03:12 sharok

I believe we could implement that just by pure CSS, without extra stuff on ngTasty. This table it's meant to be really tiny and flexible, so you can implement custom version easily.

Zizzamia avatar Dec 30 '15 21:12 Zizzamia

Yes, I made it by myself. But, we need JS code to implement it. The main problem here all plugins works when th tags are exists on the page. I have written custom directive:

  .directive('tableResizable', ['$timeout',function ($timeout) {
         function checkHeaderExist(element) {
            $timeout(function () {
                if($(element[0]).has('th').length > 0)
                {
                    $(element[0]).resizableColumns();
                }
                else {
                    checkHeaderExist(element);
                }
            })
        }

        return {
            restrict: 'A',
            link: function (scope, element, attrs) {
                checkHeaderExist(element);
            }
        }
    }]);

But, I think resize is very important feature and has to be in every table. But, It's your component and you decide what is the best for it. I would implement it but I am very beginner in JS and angular.

sharok avatar Dec 31 '15 04:12 sharok

Not sure resizable table need JS, should not be just need it CSS? I will take some time to do all the need it research.

Zizzamia avatar Dec 31 '15 19:12 Zizzamia