Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hel-developer-guide
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenhao
hel-developer-guide
Commits
5db93804
Commit
5db93804
authored
Jul 26, 2017
by
Jefferyne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updates 前端组件/DataSource.md
Auto commit by GitBook Editor
parent
0b5a1ede
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
220 additions
and
0 deletions
+220
-0
DataSource.md
前端组件/DataSource.md
+220
-0
Grid.md
前端组件/Grid.md
+0
-0
No files found.
前端组件/DataSource.md
0 → 100644
View file @
5db93804
# dataSource标签
数据源组件
```
xml
<h:dataSource
id=
"gridDataSource"
batch=
"true"
pageSize=
"10"
serverPaging=
"true"
error=
"requestError"
>
<h:transport
parameterMap=
"parameterMap"
>
<h:read
url=
"${base.contextPath}/sys/resource/query"
type=
"POST"
dataType=
"json"
/>
<h:create
url=
"${base.contextPath}/sys/resource/submit"
type=
"POST"
contentType=
"application/json"
/>
<h:update
url=
"${base.contextPath}/sys/resource/submit"
type=
"POST"
contentType=
"application/json"
/>
<h:destroy
url=
"${base.contextPath}/sys/resource/remove"
type=
"POST"
contentType=
"application/json"
/>
</h:transport>
<h:schema
data=
"rows"
total=
"total"
errors=
"schemaError"
>
<h:model
id=
"resourceId"
editable=
"dsEditable"
>
<h:fields>
<h:item
name=
"loginRequire"
defaultValue=
"Y"
type=
"boolean"
checkedValue=
"Y"
uncheckedValue=
"N"
/>
<h:item
name=
"accessCheck"
defaultValue=
"Y"
type=
"boolean"
checkedValue=
"Y"
uncheckedValue=
"N"
/>
<h:item
name=
"type"
defaultValue=
""
/>
<h:item
name=
"url"
>
<h:validation
required=
"true"
/>
</h:item>
<h:item
name=
"name"
>
<h:validation
required=
"true"
/>
</h:item>
</h:fields>
</h:model>
</h:schema>
</h:dataSource>
```
### **主要属性**
| 属性名 | 类型 |
| --- | --- |
| data | Array & String |
| autoSync | Boolean |
| batch | Boolean |
| page | Integer |
| pageSize | Integer |
| serverAggregates | Boolean |
| serverFiltering | Boolean |
| serverGrouping | Boolean |
| serverPaging | Boolean |
| serverSorting | Boolean |
| type | String |
| change | Function |
| error | Function |
| push | Function |
| requestEnd | Function |
| requestStart | Function |
| sync | Function |
> **提示:** 属性用法请参考kendoui API文档 [http://docs.telerik.com/kendo-ui/api/javascript/data/datasource](http://docs.telerik.com/kendo-ui/api/javascript/data/datasource)
### **主要子节点**
*
transport
*
schema
*
sort
### **transport**
服务端交互配置
#### **transport属性**
| 属性名 | 类型 |
| --- | --- |
| parameterMap | Function |
| push | Function |
```
xml
<h:dataSource
id=
"gridDataSource"
>
<h:transport
parameterMap=
"parameterMap"
>
...
</h:transport>
</h:dataSource>
```
#### **transport子节点**
主要有以下几种节点类型
*
read
*
create
*
update
*
destroy
| 属性名 | 类型 |
| --- | --- |
| cache | Boolean |
| contentType | String |
| data | Object
\|
Function |
| dataType | String |
| type | String |
| url | String
\|
Function |
```
xml
<h:transport
parameterMap=
"parameterMap"
>
<h:read
url=
"${base.contextPath}/sys/resource/query"
type=
"POST"
dataType=
"json"
/>
<h:create
url=
"${base.contextPath}/sys/resource/submit"
type=
"POST"
contentType=
"application/json"
/>
<h:update
url=
"${base.contextPath}/sys/resource/submit"
type=
"POST"
contentType=
"application/json"
/>
<h:destroy
url=
"${base.contextPath}/sys/resource/remove"
type=
"POST"
contentType=
"application/json"
/>
</h:transport>
```
### **schema**
定义datasource的数据结构
#### **schema属性**
| 属性名 | 类型 |
| --- | --- |
| data | String
\|
Function |
| errors | String
\|
Function |
| groups | String
\|
Function |
| parse | Function |
| total | String
\|
Function |
| type | String |
```
xml
<h:dataSource
id=
"gridDataSource"
>
<h:schema
data=
"rows"
total=
"total"
errors=
"schemaError"
>
...
</h:schema>
</h:dataSource>
```
#### **schema子节点**
*
model
| 属性名 | 类型 |
| --- | --- |
| id | String |
| editable | Function |
```
xml
<h:schema
data=
"rows"
total=
"total"
errors=
"schemaError"
>
<h:model
id=
"resourceId"
editable=
"dsEditable"
>
<h:fields>
...
</h:fields>
</h:model>
</h:schema>
```
#### **model子节点**
*
field
| 属性名 | 类型 |
| --- | --- |
| name | String |
| defaultValue | Object |
| editable | Boolean |
| nullable | Boolean |
| parse | Function |
| type | String |
| from | String |
| checkedValue | String |
| uncheckedValue | String |
```
xml
<h:schema
data=
"rows"
total=
"total"
errors=
"schemaError"
>
<h:model
id=
"resourceId"
editable=
"dsEditable"
>
<h:fields>
<h:item
name=
"loginRequire"
defaultValue=
"Y"
type=
"boolean"
checkedValue=
"Y"
uncheckedValue=
"N"
/>
<h:item
name=
"accessCheck"
defaultValue=
"Y"
type=
"boolean"
checkedValue=
"Y"
uncheckedValue=
"N"
/>
<h:item
name=
"type"
defaultValue=
""
/>
<h:item
name=
"url"
>
<h:validation
required=
"true"
/>
</h:item>
<h:item
name=
"name"
>
<h:validation
required=
"true"
/>
</h:item>
</h:fields>
</h:model>
</h:schema>
```
#### **field子节点**
*
validation
| 属性名 | 类型 |
| --- | --- |
| required | Boolean |
| max | Integer |
| min | Integer |
### **sort**
| 属性名 | 类型 |
| --- | --- |
| dir | String |
| field | String |
| compare | function |
```
xml
<h:dataSource
id=
"gridDataSource"
batch=
"true"
pageSize=
"10"
serverPaging=
"true"
serverSorting=
"true"
error=
"requestError"
>
<h:transport
parameterMap=
"parameterMap"
>
...
</h:transport>
<h:schema
data=
"rows"
total=
"total"
errors=
"schemaError"
>
<h:model
id=
"resourceId"
editable=
"dsEditable"
>
<h:fields>
...
</h:fields>
</h:model>
</h:schema>
<h:sort>
<h:item
field=
"url"
dir=
"desc"
/>
</h:sort>
</h:dataSource>
```
前端组件/Grid.md
View file @
5db93804
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment