我正在尝试为SecurityDefinition构建Swagger设置,以便在openapi.json中获得以下结果:
"securityDefinitions": {
"password": {
"type": "oauth2",
"tokenUrl": "http://example.com/oauth/token",
"flow": "password",
"scopes": {
"write": "allows modifying resources",
"read": "allows reading resources"
}
}
},
"security": [{
"password": ["read", "write"]
}]
Run Code Online (Sandbox Code Playgroud)
在我的settings.py中,我添加了以下swagger设置:
# Swagger settings
SWAGGER_SETTINGS = {
"SECURITY_DEFINITIONS": {
"password": {
"type": "oauth2",
"tokenUrl": "http://example.com/oauth/token",
"flow": "password",
"scopes": {
"write": "allows modifying resources",
"read": "allows reading resources"
}
}
},
"SECURITY": [{
"password": ["read", "write"]
}]
}
Run Code Online (Sandbox Code Playgroud)
问题是在Swagger生成的openapi.json中没有securitydict,我也不知道它是如何生成的.
下面,介绍了生成的openapi.json:
{
"info": {
"title": "Example Service API",
"version": "" …Run Code Online (Sandbox Code Playgroud) 我正在使用md-data-table,并添加了基于列的排序选项。下面,展示了我的html(pug格式)代码:
table(md-table md-row-select multiple='' ng-model='vm.selected' md-progress='promise')
//- columns
thead(md-head class='back-color')
tr(md-row)
th(md-column ng-click='vm.orderingBy(name)')
span Name
th(md-column ng-click='vm.sortingBy(code)')
span Code
//- rows
tbody(md-body)
tr(md-select='record' md-select-id='id' ng-repeat='record in vm.records | orderBy:vm.orderByColumn)
//- name
td(md-cell)
p(ng-hide='vm.columns.edit') {{record.name}}
md-input-container(ng-if='vm.columns.edit' class='no-errors-spacer md-no-margin')
input(ng-model='record.name' md-select-on-focus)
//- code
td(md-cell)
p(ng-hide='vm.columns.edit') {{record.sorting_code}}
md-input-container(ng-if='vm.columns.edit' class='no-errors-spacer md-no-margin')
input(ng-model='record.code' md-select-on-focus)
Run Code Online (Sandbox Code Playgroud)
我的AngularJS(Javascript)代码如下所示:
vm.orderByColumn = 'name';
vm.orderingBy = function(ordering) {
vm.orderByColumn = ordering;
}
Run Code Online (Sandbox Code Playgroud)
问题是当表按“代码”排序时,我正在尝试编辑记录的代码,当您更改代码的值时,记录的顺序也会改变。因此,结果非常混乱。我在考虑在编辑模式下是否可以冻结订单。
是否可以使用Shift和鼠标单击使用AngularJS在表格上选择多个元素?
我有一个表,其中第一列是一个复选框,我想使用SHIFT键和鼠标单击以连续选择多行,可以执行删除,编辑等操作.
示例步骤:
结果:将选择前10行.
有谁知道如何使用AngularJS完成这项工作?