Last active
January 16, 2016 08:03
-
-
Save SmartfaceDocs/5aa40d93fd296a7d2ef9 to your computer and use it in GitHub Desktop.
RepeatBox Guide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rBox.useActiveItem = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeatBox1.autoSize = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rBox = new SMF.UI.RepeatBox({ | |
width : "100%", | |
height : "100%", | |
left : 0, | |
top : 0, | |
showScrollbar : true, | |
fillColor : "#3B3B3B" | |
}); | |
Pages.Page1.add(rBox); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data.execute("DROP TABLE IF EXISTS testtable;"); | |
Data.execute("Create table testtable (col1 string)"); | |
Data.execute("insert into testtable values('My first row');"); | |
Data.execute("insert into testtable values('Smartface.Inc');"); | |
Data.execute("insert into testtable values('Smartface App Studio');"); | |
Data.dynamicDS = new Data.Dataset({ | |
selectQuery : "select * from testtable" | |
}); | |
Data.dynamicDS.refresh(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myDataSource = [{ | |
row : "First Row" | |
}, { | |
row : "Second Row" | |
}, { | |
row : "Third Row" | |
} | |
]; | |
var lbl = new SMF.UI.Label({ | |
top : "0%", | |
left : "0%", | |
width : "100%", | |
height : "100%", | |
fillColor : "#FFFFFF", | |
textAlignment : SMF.UI.TextAlignment.center | |
}); | |
var repeatBox1 = new SMF.UI.RepeatBox({ | |
width : "60%", | |
height : "50%", | |
left : "20%", | |
top : "25%", | |
showScrollbar : true, | |
fillColor : "white", | |
backgroundTransparent : true | |
}); | |
repeatBox1.dataSource = myDataSource; | |
repeatBox1.onRowRender = function (e) { | |
this.controls[0].text = myDataSource[e.rowIndex].row; | |
}; | |
repeatBox1.onSelectedItem = function (e) { | |
alert("Selected " + (e.rowIndex + 1) + ". row"); | |
}; | |
repeatBox1.onRowDeleting = function (e) { | |
if (e.rowIndex === 0) { | |
alert("first row is deleted..."); | |
} | |
}; | |
repeatBox1.itemTemplate.height = Device.screenHeight / 7; | |
repeatBox1.itemTemplate.imageFillType = SMF.UI.ImageFillType.stretch; | |
repeatBox1.itemTemplate.add(lbl); | |
Pages.Page1.add(repeatBox1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeatBox1.dataSource = myDataSource; | |
repeatBox1.onRowRender = function (e) { | |
this.controls[0].text = myDataSource[e.rowIndex].row; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rBox.groupItems = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeatBox1.itemTemplate.height = Device.screenHeight / 7; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lbl = new SMF.UI.Label({ | |
top : "0%", | |
left : "0%", | |
width : "100%", | |
height : "100%", | |
fillColor : "#FFFFFF", | |
textAlignment : SMF.UI.TextAlignment.center | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myDataSource = [{ | |
row : "First Row" | |
}, { | |
row : "Second Row" | |
}, { | |
row : "Third Row" | |
} | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rBox.enablePullDownToRefresh = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rBox.enablePullUpToRefresh = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var repeatBox1 = new SMF.UI.RepeatBox({ | |
name : "repeatBox1", | |
width : "60%", | |
height : "50%", | |
left : "20%", | |
top : "25%", | |
dataSource : Data.dynamicDS, | |
showScrollbar : true, | |
fillColor : "white", | |
backgroundTransparent : true, | |
onRowRender : function (e) { | |
Data.dynamicDS.seek(e.rowIndex); | |
this.controls[0].text = Data.dynamicDS.col1; | |
} | |
}); | |
repeatBox1.itemTemplate.height = Device.screenHeight / 7; | |
repeatBox1.itemTemplate.imageFillType = SMF.UI.ImageFillType.stretch; | |
//Adding label to repeatBox object | |
repeatBox1.itemTemplate.add(lbl); | |
Pages.Page1.add(repeatBox1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rBox.showHeader = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var itemDelete = new SMF.UI.RepeatBoxSwipeItem({ | |
width : 50, | |
height : "100%", | |
left : repeatBox1.width - 50, | |
top : 0, | |
text : "Delete", | |
fontColor : "#dddddd", | |
fillColor : "#ff0000", | |
onSelected : function (e) { | |
alert("Delete button pressed for the row: " + e.rowIndex); | |
} | |
}); | |
var itemMore = new SMF.UI.RepeatBoxSwipeItem({ | |
width : 50, | |
height : "100%", | |
x : "50%", | |
y : 0, | |
onSelected : function (e) { | |
alert("Pressed!"); | |
} | |
}); | |
var items = [itemDelete, itemMore]; | |
repeatBox1.setSwipeItems(items); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment