Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何设计允许列重新排序/隐藏的网格视图指令?_Angularjs_Angularjs Directive_Pug - Fatal编程技术网

Angularjs 如何设计允许列重新排序/隐藏的网格视图指令?

Angularjs 如何设计允许列重新排序/隐藏的网格视图指令?,angularjs,angularjs-directive,pug,Angularjs,Angularjs Directive,Pug,我正在尝试创建一个类似以下内容的AngularJS指令: gridview(ng-show="people.length > 0") column(name="checkbox") th td input(type="checkbox" ...) column(name="name" moveable toggleable) th Name td input(typ

我正在尝试创建一个类似以下内容的AngularJS指令:

gridview(ng-show="people.length > 0")
    column(name="checkbox")
        th
        td
            input(type="checkbox" ...)
    column(name="name" moveable toggleable)
        th Name
        td
           input(type="text" ng-model="person.name")
    column(name="address" moveable toggleable)
        ...
    column(name="phone" moveable toggleable)
        ...
    column(name="actions")
        td
            a(href="#") delete

gridview-settings(ng-show="people.length > 0")
我想知道构建此指令的最佳方式是什么

gridview设置应该弹出一个带有列名的模式,我可以检查该列名以启用/禁用并重新排序

如何有条件地以正确的列顺序呈现表

如何在gridview和gridview设置之间共享列信息


另外,我已经看过几个gridview库,它们都不适合我要做的事情,所以我正在寻找帮助来建立这个指令,而不是参考另一个库。

所以我做了一些研究和实验,这就是我想到的。我不确定这是最好的方式。我仍然对其他想法持开放态度

directive: gridview
   compile:
     - parse the markup to extract the declarative table definition
   pre-link:
     - save the declarative definition in a scope variable (specified from an attr)
     - load any user preferences from backend
   post-link:
     - render the table
     - watch for changes to declarative definition from gridview-settings and re-render

directive: gridview-settings
   - receives the reference to the declarative specification as an attr (name of the var on the scope)
   - allows for changes to the declarative settings