data-toggle="dropdown"> <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
- <li><a href='' ng-click="showGridConf = !showGridConf">
- <span class="glyphicon glyphicon-wrench"></span>
- [% l('Configure Columns') %]
+ <li>
+ <a href='' ng-click="toggleGridConf()">
+ <span class="glyphicon glyphicon-wrench"></span>
+ [% l('Configure Columns') %]
</a>
</li>
<li role="presentation" class="divider"></li>
style="flex:{{column.flexWidth}}"
ng-show="dataList.displayColumns[column.name]">
<div style="width:100%;text-align:center">
- <a href="javascript:;" title="[% l('Make column wider') %]"
+ <a href="" title="[% l('Make column wider') %]"
ng-click="column.flexWidth = column.flexWidth + 1">
<span class="glyphicon glyphicon-fast-forward"></span>
</a>
</div>
<div style="width:100%;text-align:center;border-top:1px solid #ccc">
- <a href="javascript:;" title="[% l('Make column narrower') %]"
+ <a href="" title="[% l('Make column narrower') %]"
ng-click="column.flexWidth = column.flexWidth - 1">
<span class="glyphicon glyphicon-fast-backward"></span>
</a>
</div>
<div style="width:100%;text-align:center;border-top:1px solid #ccc">
<input type='number' ng-model="column.sortPriority"
- title="[% l('Sort Priority') %]" style='width:3em'/>
+ title="[% l('Sort Priority') %]" style='width:2.3em'/>
</div>
</div>
</div>
<div class="eg-grid-cell eg-grid-cell-1">
<!-- ng-click=handleRowClick here has unintended
consequences and is unnecessary, avoid it -->
- <input type='checkbox' ng-model="dataList.selected[dataList.indexValue(item)]"/>
+ <input type='checkbox'
+ ng-model="dataList.selected[dataList.indexValue(item)]"/>
</div>
<div class="eg-grid-cell"
ng-click="handleRowClick($event, item)"
$scope.fetchData();
}
+ // maps numeric sort priority to flattener sort blob
+ this.compileSort = function() {
+
+ var sortList = $scope.dataList.allColumns.filter(
+ function(col) { return Number(col.sortPriority) }
+ ).sort(
+ function(a, b) {
+ return
+ Math.abs(a.sortPriority) < Math.abs(b.sortPriority)
+ ? -1 : 1;
+ }
+ );
+
+ $scope.sort = sortList.map(function(col) {
+ var blob = {};
+ blob[col.name] = col.sortPriority < 0 ? 'desc' : 'asc';
+ return blob;
+ });
+ console.log(js2JSON($scope.sort));
+ },
+
+ $scope.toggleGridConf = function() {
+ if ($scope.showGridConf) {
+ $scope.showGridConf = false;
+ // configuration done; reload data
+ self.compileSort();
+ $scope.fetchData();
+ } else {
+ $scope.showGridConf = true;
+ }
+ }
+
/**
* Adds a column from an eg-grid-field or directly from
* an IDL field via compileAutoFields.