sublists [] = [[]]
sublists (x:xs) = [x:sublist | sublist <- sublists xs]
++ sublists xs
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,有人可以解释一下[x:sublist | sublist <- sublists xs]这行的确切发生以及<-这种类型的构造函数到底是做什么的吗?
我想在单击编辑按钮时只读取一个字段,但是在单击添加按钮时可以输入值.我试过角度ng-readonly但到目前为止还没有工作.有什么建议?
HTML
<tr ng-repeat="row in rowCollection">
<td><span editable-text="row.inputToken" e-name="inputToken" e-form="gridForm" ng-disabled="row.isreadonly">{{row.inputToken}}</span></td>
<td><span editable-text="row.standardForm" e-name="standardForm" e-form="gridForm">{{row.standardForm}}</span></td>
<td><span editable-select="row.classification" e-name="classification" onshow="" e-form="gridForm">{{row.classification}}</span></td>
<td><span editable-text="row.similarityThreshold" e-name="similarityThreshold" e-form="gridForm">{{row.similarityThreshold}}</span></td>
<td style="white-space: nowrap">
<form editable-form name="gridForm" onbeforesave="saveRecord($data)" ng-show="gridForm.$visible" class="form-buttons form inline" shown="inserted == row">
<button type="submit" ng-disabled="gridForm.$waiting" class="btn">Save</button>
<button type="button" ng-disabled="gridForm.$waiting" ng-click="cancelRecord();gridForm.$cancel()" class="btn">Cancel</button>
</form>
<div class="buttons" ng-show="!gridForm.$visible">
<button class="btn" type="button" ng-click="gridForm.$show()">Edit</button>
<button class="btn" type="button" ng-click="deleteRecord($index)">Delete</button>
</div>
</td>
</tr>
</tbody>
Run Code Online (Sandbox Code Playgroud)
Controller.js
var stan = angular.module('stanuiApp', ['ui.bootstrap','smart-table','xeditable']);
stan.run(function(editableOptions){
editableOptions.theme = 'default';
});
stan.controller('MainCtrl',function ($scope, $window, $http,$filter) {
$scope.root …Run Code Online (Sandbox Code Playgroud)