mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-22 19:00:07 +08:00
Merge pull request #488 from yanhuacuo/path-for-insertRow
Add the functionality to insert new rows into the table
This commit is contained in:
commit
2d4e61445e
@ -1968,7 +1968,7 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="177"/>
|
<location filename="qml/page/T_TableView.qml" line="177"/>
|
||||||
<location filename="qml/page/T_TableView.qml" line="499"/>
|
<location filename="qml/page/T_TableView.qml" line="513"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -1998,37 +1998,47 @@ Some contents...</source>
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="494"/>
|
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||||
|
<source>Insert a Row</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="478"/>
|
||||||
|
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="508"/>
|
||||||
<source>Avatar</source>
|
<source>Avatar</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="512"/>
|
<location filename="qml/page/T_TableView.qml" line="526"/>
|
||||||
<source>Address</source>
|
<source>Address</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="520"/>
|
<location filename="qml/page/T_TableView.qml" line="534"/>
|
||||||
<source>Nickname</source>
|
<source>Nickname</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="527"/>
|
<location filename="qml/page/T_TableView.qml" line="541"/>
|
||||||
<source>Long String</source>
|
<source>Long String</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="535"/>
|
<location filename="qml/page/T_TableView.qml" line="549"/>
|
||||||
<source>Options</source>
|
<source>Options</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="554"/>
|
<location filename="qml/page/T_TableView.qml" line="568"/>
|
||||||
<source><Previous</source>
|
<source><Previous</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="555"/>
|
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||||
<source>Next></source>
|
<source>Next></source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2110,7 +2110,7 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="177"/>
|
<location filename="qml/page/T_TableView.qml" line="177"/>
|
||||||
<location filename="qml/page/T_TableView.qml" line="499"/>
|
<location filename="qml/page/T_TableView.qml" line="513"/>
|
||||||
<source>Name</source>
|
<source>Name</source>
|
||||||
<translation type="unfinished">名称</translation>
|
<translation type="unfinished">名称</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -2140,37 +2140,47 @@ Some contents...</source>
|
|||||||
<translation type="unfinished">清除所有</translation>
|
<translation type="unfinished">清除所有</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="494"/>
|
<location filename="qml/page/T_TableView.qml" line="470"/>
|
||||||
|
<source>Insert a Row</source>
|
||||||
|
<translation type="unfinished">插入一行</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="478"/>
|
||||||
|
<source>Focus not acquired: Please click any item in the form as the target for insertion!</source>
|
||||||
|
<translation type="unfinished">焦点未获取:请点击表格中的任意一项,作为插入的靶点!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_TableView.qml" line="508"/>
|
||||||
<source>Avatar</source>
|
<source>Avatar</source>
|
||||||
<translation type="unfinished">头像</translation>
|
<translation type="unfinished">头像</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="512"/>
|
<location filename="qml/page/T_TableView.qml" line="526"/>
|
||||||
<source>Address</source>
|
<source>Address</source>
|
||||||
<translation type="unfinished">地址</translation>
|
<translation type="unfinished">地址</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="520"/>
|
<location filename="qml/page/T_TableView.qml" line="534"/>
|
||||||
<source>Nickname</source>
|
<source>Nickname</source>
|
||||||
<translation type="unfinished">昵称</translation>
|
<translation type="unfinished">昵称</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="527"/>
|
<location filename="qml/page/T_TableView.qml" line="541"/>
|
||||||
<source>Long String</source>
|
<source>Long String</source>
|
||||||
<translation type="unfinished">长字符串</translation>
|
<translation type="unfinished">长字符串</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="535"/>
|
<location filename="qml/page/T_TableView.qml" line="549"/>
|
||||||
<source>Options</source>
|
<source>Options</source>
|
||||||
<translation type="unfinished">操作</translation>
|
<translation type="unfinished">操作</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="554"/>
|
<location filename="qml/page/T_TableView.qml" line="568"/>
|
||||||
<source><Previous</source>
|
<source><Previous</source>
|
||||||
<translation type="unfinished"><上一页</translation>
|
<translation type="unfinished"><上一页</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_TableView.qml" line="555"/>
|
<location filename="qml/page/T_TableView.qml" line="569"/>
|
||||||
<source>Next></source>
|
<source>Next></source>
|
||||||
<translation type="unfinished">下一页></translation>
|
<translation type="unfinished">下一页></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -13,7 +13,7 @@ FluContentPage{
|
|||||||
|
|
||||||
property var dataSource : []
|
property var dataSource : []
|
||||||
property int sortType: 0
|
property int sortType: 0
|
||||||
property bool seletedAll: true
|
property bool selectedAll: true
|
||||||
property string nameKeyword: ""
|
property string nameKeyword: ""
|
||||||
|
|
||||||
onNameKeywordChanged: {
|
onNameKeywordChanged: {
|
||||||
@ -32,11 +32,11 @@ FluContentPage{
|
|||||||
onCheckBoxChanged: {
|
onCheckBoxChanged: {
|
||||||
for(var i =0;i< table_view.rows ;i++){
|
for(var i =0;i< table_view.rows ;i++){
|
||||||
if(false === table_view.getRow(i).checkbox.options.checked){
|
if(false === table_view.getRow(i).checkbox.options.checked){
|
||||||
root.seletedAll = false
|
root.selectedAll = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
root.seletedAll = true
|
root.selectedAll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
onSortTypeChanged: {
|
onSortTypeChanged: {
|
||||||
@ -238,12 +238,12 @@ FluContentPage{
|
|||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
FluCheckBox{
|
FluCheckBox{
|
||||||
checked: true === root.seletedAll
|
checked: true === root.selectedAll
|
||||||
animationEnabled: false
|
animationEnabled: false
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
clickListener: function(){
|
clickListener: function(){
|
||||||
root.seletedAll = !root.seletedAll
|
root.selectedAll = !root.selectedAll
|
||||||
var checked = root.seletedAll
|
var checked = root.selectedAll
|
||||||
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
|
itemModel.display = table_view.customItem(com_column_checbox,{"checked":checked})
|
||||||
for(var i =0;i< table_view.rows ;i++){
|
for(var i =0;i< table_view.rows ;i++){
|
||||||
var rowData = table_view.getRow(i)
|
var rowData = table_view.getRow(i)
|
||||||
@ -466,6 +466,20 @@ FluContentPage{
|
|||||||
table_view.appendRow(genTestObject())
|
table_view.appendRow(genTestObject())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluButton{
|
||||||
|
text: qsTr("Insert a Row")
|
||||||
|
onClicked: {
|
||||||
|
if(typeof table_view.current !== 'undefined'){
|
||||||
|
var newLine = genTestObject()
|
||||||
|
var currentLine = dataSource.findIndex(obj => obj._key === table_view.current._key)
|
||||||
|
root.dataSource.splice(currentLine, 0, newLine);
|
||||||
|
table_view.dataSource = root.dataSource
|
||||||
|
}else{
|
||||||
|
showWarning(qsTr("Focus not acquired: Please click any item in the form as the target for insertion!"))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,7 +602,7 @@ FluContentPage{
|
|||||||
return avatars[randomIndex];
|
return avatars[randomIndex];
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
checkbox: table_view.customItem(com_checbox,{checked:root.seletedAll}),
|
checkbox: table_view.customItem(com_checbox,{checked:root.selectedAll}),
|
||||||
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
avatar:table_view.customItem(com_avatar,{avatar:getAvatar()}),
|
||||||
name: getRandomName(),
|
name: getRandomName(),
|
||||||
age:getRandomAge(),
|
age:getRandomAge(),
|
||||||
@ -601,7 +615,7 @@ FluContentPage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
function loadData(page,count){
|
function loadData(page,count){
|
||||||
root.seletedAll = true
|
root.selectedAll = true
|
||||||
const dataSource = []
|
const dataSource = []
|
||||||
for(var i=0;i<count;i++){
|
for(var i=0;i<count;i++){
|
||||||
dataSource.push(genTestObject())
|
dataSource.push(genTestObject())
|
||||||
|
Loading…
Reference in New Issue
Block a user