- Angular just like framework
- react is just like library
- Node.js is support file like. can install it with command prompt.
Sunday, December 30, 2018
Tuesday, December 18, 2018
NFI and FFI Difference
NFI(Native Function Integration) programming code for application has been created in native(android application).we can access through the native package to Kony. (like predefined Program).
AAR if a full package with UI
all widget created in Kony as like JSON obj.
FFI (Foreign Function Integration) jar contains functionality.we have to insert it in kony third-party integration.
https://basecamp.kony.com/s/article-detail/a046A00000CbHMIQA3/support-for-nfiffi-in-kony-visualizer
AAR if a full package with UI
all widget created in Kony as like JSON obj.
FFI (Foreign Function Integration) jar contains functionality.we have to insert it in kony third-party integration.
https://basecamp.kony.com/s/article-detail/a046A00000CbHMIQA3/support-for-nfiffi-in-kony-visualizer
Thursday, December 13, 2018
Calender widget Validation
//Type your code here
function SdateLoad(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd = '0'+dd;
}
if(mm<10) {
mm = '0'+mm;
}
frmHome.Calone.validEndDate = [dd,mm,yyyy];
frmHome.calTwo.validStartDate = [dd,mm,yyyy];
frmHome.calThree.validStartDate = [dd,mm,yyyy];
frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}
function SdateproperOneOnSelection(evenobj){
alert("Selected date" + evenobj.day + "/" + evenobj.month + "/" + evenobj.year);
}
function SdateproperThreeOnSelection(evenobj){
frmHome.Calfour.validStartDate = [evenobj.day, evenobj.month, evenobj.year];
frmHome.Calfour.dateComponents = [evenobj.day, evenobj.month, evenobj.year];
}
function doreset(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd = '0'+dd;
}
if(mm<10) {
mm = '0'+mm;
}
frmHome.Calone.dateComponents = [dd,mm,yyyy];
frmHome.calTwo.dateComponents = [dd,mm,yyyy];
frmHome.calThree.dateComponents = [dd,mm,yyyy];
frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}
function SdateLoad(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd = '0'+dd;
}
if(mm<10) {
mm = '0'+mm;
}
frmHome.Calone.validEndDate = [dd,mm,yyyy];
frmHome.calTwo.validStartDate = [dd,mm,yyyy];
frmHome.calThree.validStartDate = [dd,mm,yyyy];
frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}
function SdateproperOneOnSelection(evenobj){
alert("Selected date" + evenobj.day + "/" + evenobj.month + "/" + evenobj.year);
}
function SdateproperThreeOnSelection(evenobj){
frmHome.Calfour.validStartDate = [evenobj.day, evenobj.month, evenobj.year];
frmHome.Calfour.dateComponents = [evenobj.day, evenobj.month, evenobj.year];
}
function doreset(){
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd = '0'+dd;
}
if(mm<10) {
mm = '0'+mm;
}
frmHome.Calone.dateComponents = [dd,mm,yyyy];
frmHome.calTwo.dateComponents = [dd,mm,yyyy];
frmHome.calThree.dateComponents = [dd,mm,yyyy];
frmHome.Calfour.dateComponents = [dd,mm,yyyy];
}
Sunday, December 9, 2018
component: add it programmatically?
var tabs = new com.konymp.tabstextline(
{
"clipBounds":true,
"id": "tabstextline",
"isVisible": true,
"zIndex": 1
}, {}, {});
Wednesday, December 5, 2018
Without contract / with contract in components
1) Masters 1.0 (Now deprecated)
- No controllers
2) Components without contract
- Always has controller
- Instances always show complete widget hierarchy as in source
- No custom events
- All properties can be overwritten in instance
3) Components with contract
- Always has controller
- Instance doesn't show any hierarchy (unless explicitly exposed)
- Custom events
- Control over what properties can be overwritten in instance (by making them pass-through)
So if you want to build you own calculator component and expose selected custom events for any user, you should choose components with contract.
Tuesday, December 4, 2018
How to take IOS build in kony
How to take ios build in Xcode (Kony) ?
1.Take IOS build (KAR file is generated).
2.Add latest plugins from visualizer (path: visualizer ->open file location -> plugins -> search(ios plugin and copy)).
3.Transfer plugins(we get plugins as JAR file [Rename as .Zip]) and KAR file in one folder.
4.Zip file should be extracted we get one more Zip file(Extract it) .Now we get gen file.
5.Open terminal 1.cd ( Drag gen file).
2.perl extract.pl ( Drag KAR file).
6. We get Executable VM project file(Double click it).
7.Set as Krelease and generic ios build.
Monday, December 3, 2018
Segment expandable view single row only open at the time sample
var gblHfd ="";
function onrowclickofseg(){
var cisshow;
var selectedIndex= frmQA.Seg.selectedRowIndex[1];
if(frmQA.Seg.selectedRowItems[0].flxQA2.isVisible === true){
cisshow = false;
//gblHfd = "";
}else{
cisshow = true;
//gblHfd = selectedIndex;
}
if(gblHfd !== ""){
var obj1 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:false},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj1,gblHfd,0);
var obj2 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj2,selectedIndex,0);
}else{
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj,selectedIndex,0);
}
if(cisshow === true){
gblHfd = selectedIndex;
}else{
gblHfd = "";
}
}
function onrowclickofseg(){
var cisshow;
var selectedIndex= frmQA.Seg.selectedRowIndex[1];
if(frmQA.Seg.selectedRowItems[0].flxQA2.isVisible === true){
cisshow = false;
//gblHfd = "";
}else{
cisshow = true;
//gblHfd = selectedIndex;
}
if(gblHfd !== ""){
var obj1 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:false},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj1,gblHfd,0);
var obj2 = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj2,selectedIndex,0);
}else{
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj,selectedIndex,0);
}
if(cisshow === true){
gblHfd = selectedIndex;
}else{
gblHfd = "";
}
}
Saturday, December 1, 2018
How to create SQLite Database & access with in Kony
Before refer below code check: SQLite_App its easy to understand
/*****************************************************************
Name : createDB
Purpose : To create the database with employee_details table
******************************************************************/
function createDB() {
webSQLFlag = 1;
baseObjectId = kony.db.openDatabase("webSqlDB",
"1.0",
"Sample SQL Database",
5 * 1024 * 1024); // 5MB database
kony.db.transaction(baseObjectId,
createTable,
commonErrorCallback,
commonVoidcallback);
}
/*****************************************************************
Name : createTable
Purpose : To create emp_details table with 4 rows
******************************************************************/
function createTable(dbId) {
var sqlStatement = "DROP TABLE IF EXISTS emp_details";
kony.db.executeSql(dbId,
sqlStatement,
null,
success_dropTable,
commonErrorCallback);
var sqlStatement = "CREATE TABLE IF NOT EXISTS emp_details (empid REAL PRIMARY KEY,empname TEXT,depid REAL)";
kony.db.executeSql(dbId,
sqlStatement,
null,
success_createTable,
commonErrorCallback);
}
/*****************************************************************
Name : commonErrorCallback
Purpose : To display error message on the console
******************************************************************/
function commonErrorCallback(transactionId, error) {
kony.print(" Error code:: " + error);
kony.print(" Error message:: " + error.message);
}
/*****************************************************************
Name : commonVoidcallback
Purpose : To display success message on the console.
******************************************************************/
function commonVoidcallback() {
kony.print("The transaction was executed successfully.");
}
/*****************************************************************
Name : success_dropTable
Purpose : To display a message on the console when table creation is unsuccessful.
******************************************************************/
function success_dropTable(transactionId, resultset) {
kony.print("Table was dropped");
}
/*****************************************************************
Name : Transaction
Purpose : To open a transaction on click of Add button.
******************************************************************/
function transaction() {
baseObjectId = kony.db.openDatabase("webSqlDB",
"1.0",
"Sample SQL Database",
5 * 1024 * 1024);
kony.db.transaction(baseObjectId, insertTable, commonErrorCallback, commonVoidcallback);
}
/*****************************************************************
Name : insertTable
Purpose : To insert row in the table
******************************************************************/
function insertTable(dbId) {
var empID = MainForm.IDTextBox.text;
var empName = MainForm.NameTextBox.text;
var depID = MainForm.DepartmentTextBox.text;
var sqlStatement = "INSERT INTO emp_details VALUES (" + empID + ",\"" + empName + "\"," + depID + ")";
kony.db.executeSql(dbId,
sqlStatement,
null,
success_insertTable,
commonErrorCallback);
var sqlStatement = "SELECT * FROM emp_details";
kony.db.executeSql(dbId,
sqlStatement,
null,
success_sqlSelect,
commonErrorCallback);
ListForm.show();
}
/*****************************************************************
Name : success_insertTable
Purpose :alert of successfully inserted table
******************************************************************/
function success_insertTable(transactionId, resultset) {
kony.print("Insert is done successfully");
}
/*****************************************************************
Name : success_sqlSelect
Purpose : To show all the rows of 'emp_details' table in the form
******************************************************************/
function success_sqlSelect(transactionId, resultset) {
var dataObj1;
//logic to process the resultset
for (var i = 0; i < resultset.rows.length; i++) {
var rowItem = kony.db.sqlResultsetRowItem(transactionId, resultset, i);
kony.print(" empname:" + rowItem.empname);
dataObj1 = {
empID: rowItem.empid,
empName: rowItem.empname,
depID: rowItem.depid,
};
ListForm.Segment01.addDataAt(dataObj1, i);
}
}
/*****************************************************************
Name : success_createTable
Purpose : To display a message when table creation is successful.
******************************************************************/
function success_createTable(transactionId, resultset) {
kony.print("Table is created successfully");
}
Friday, November 30, 2018
Expandable row with section header in segment
Create segment:
function Dynseg2(){
var objsec1 = {"flxSection":{skin:"sknlblhdr"},"lblshirtbrand":{isVisible:true,text:"Fruits"},"imgplus":{isVisible:true,src:"vision.png"},"btnplus":{isVisible:true}};
var objsec2 = {"flxSection":{skin:"sknlblhdr"},"lblshirtbrand":{isVisible:true,text:"Chocolates"},"imgplus":{isVisible:true,src:"vision.png"},"btnplus":{isVisible:true}};
var segarray =[];
var segarray1 =[];
var segarray2 =[];
var obj;
for(var i = 0;i <5 ; i++){
if(i === 0 || i === "0"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Orange",skin:"sknlblr"}};
}else if(i === 1 || i === "1"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Apple",skin:"sknlblr"}};
}else if(i === 2 || i === "2"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Mango",skin:"sknlblr"}};
}else if(i === 3 || i === "3"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Banana",skin:"sknlblr"}};
}else if(i === 4 || i === "4"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Grabes",skin:"sknlblr"}};
}
segarray.push(obj);
}
for(var k = 0;k <5 ; k++){
if(k === 0 || k === "0"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Munch",skin:"sknlblr"}};
}else if(k === 1 || k === "1"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Berk",skin:"sknlblr"}};
}else if(k === 2 || k === "2"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Bolo",skin:"sknlblr"}};
}else if(k === 3 || k === "3"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Kitkat",skin:"sknlblr"}};
}else if(k === 4 || k === "4"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Lays",skin:"sknlblr"}};
}
segarray1.push(obj);
}
for(var j = 0;j <2 ; j++){
if(j === 0 || j === "0"){
segarray2.push([objsec1,segarray]);
}else if(j === 1 || j === "1"){
segarray2.push([objsec2,segarray1]);
}
}
frmQAsecRow.Seg.setData(segarray2);
}
function onrowclicofsegsection(event){
var segarray2 =[];
var selectedIndex= event.sectionIndex;
var datoseg = frmQAsecRow.Seg.data;
var selectsedata = datoseg[selectedIndex][0];
var rowdata = frmQAsecRow.Seg.data[selectedIndex][1];
for (var i = 0; i < rowdata.length; i++) {
if(rowdata[i].flxR2.isVisible === false){
rowdata[i].flxR2 = {isVisible:true,skin:"sknflxr"};
}else if(rowdata[i].flxR2.isVisible === true){
rowdata[i].flxR2 = {isVisible:false,skin:"sknflxr"};
}
}
segarray2 = [selectsedata,rowdata];
frmQAsecRow.Seg.setSectionAt(segarray2, selectedIndex);
}
OUTPUT:
function Dynseg2(){
var objsec1 = {"flxSection":{skin:"sknlblhdr"},"lblshirtbrand":{isVisible:true,text:"Fruits"},"imgplus":{isVisible:true,src:"vision.png"},"btnplus":{isVisible:true}};
var objsec2 = {"flxSection":{skin:"sknlblhdr"},"lblshirtbrand":{isVisible:true,text:"Chocolates"},"imgplus":{isVisible:true,src:"vision.png"},"btnplus":{isVisible:true}};
var segarray =[];
var segarray1 =[];
var segarray2 =[];
var obj;
for(var i = 0;i <5 ; i++){
if(i === 0 || i === "0"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Orange",skin:"sknlblr"}};
}else if(i === 1 || i === "1"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Apple",skin:"sknlblr"}};
}else if(i === 2 || i === "2"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Mango",skin:"sknlblr"}};
}else if(i === 3 || i === "3"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Banana",skin:"sknlblr"}};
}else if(i === 4 || i === "4"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Grabes",skin:"sknlblr"}};
}
segarray.push(obj);
}
for(var k = 0;k <5 ; k++){
if(k === 0 || k === "0"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Munch",skin:"sknlblr"}};
}else if(k === 1 || k === "1"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Berk",skin:"sknlblr"}};
}else if(k === 2 || k === "2"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Bolo",skin:"sknlblr"}};
}else if(k === 3 || k === "3"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Kitkat",skin:"sknlblr"}};
}else if(k === 4 || k === "4"){
obj = {"flxR2":{isVisible:false,skin:"sknflxr"},"lbltype1":{isVisible:true,text:"Lays",skin:"sknlblr"}};
}
segarray1.push(obj);
}
for(var j = 0;j <2 ; j++){
if(j === 0 || j === "0"){
segarray2.push([objsec1,segarray]);
}else if(j === 1 || j === "1"){
segarray2.push([objsec2,segarray1]);
}
}
frmQAsecRow.Seg.setData(segarray2);
}
function onrowclicofsegsection(event){
var segarray2 =[];
var selectedIndex= event.sectionIndex;
var datoseg = frmQAsecRow.Seg.data;
var selectsedata = datoseg[selectedIndex][0];
var rowdata = frmQAsecRow.Seg.data[selectedIndex][1];
for (var i = 0; i < rowdata.length; i++) {
if(rowdata[i].flxR2.isVisible === false){
rowdata[i].flxR2 = {isVisible:true,skin:"sknflxr"};
}else if(rowdata[i].flxR2.isVisible === true){
rowdata[i].flxR2 = {isVisible:false,skin:"sknflxr"};
}
}
segarray2 = [selectsedata,rowdata];
frmQAsecRow.Seg.setSectionAt(segarray2, selectedIndex);
}
OUTPUT:
Thursday, November 29, 2018
we write function for all widgets with code while form preshow
function sample(){
alert("hello");
}
1:
frmQA.Seg.onRowClick() = sample;
2:
frmQA.Seg.onRowClick = function(){
};
alert("hello");
}
1:
frmQA.Seg.onRowClick() = sample;
2:
frmQA.Seg.onRowClick = function(){
};
Question & answer like segment row expandable view
function onrowclickofseg(){
var cisshow;
var selectedIndex= frmQA.Seg.selectedRowIndex[1];
if(frmQA.Seg.selectedRowItems[0].flxQA2.isVisible === true){
cisshow = false;
}else{
cisshow = true;
}
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj,selectedIndex,0);
}
//Dynamic segment
function Dynseg(){
var segarray =[];
for(var i = 0;i <5 ; i++){
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:false},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
segarray.push(obj);
}
frmQA.Seg.setData(segarray);
}
OUTPUT:
var cisshow;
var selectedIndex= frmQA.Seg.selectedRowIndex[1];
if(frmQA.Seg.selectedRowItems[0].flxQA2.isVisible === true){
cisshow = false;
}else{
cisshow = true;
}
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:cisshow},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
frmQA.Seg.setDataAt(obj,selectedIndex,0);
}
//Dynamic segment
function Dynseg(){
var segarray =[];
for(var i = 0;i <5 ; i++){
var obj = {"flxQA1":{isVisible:true},"lblQ":{isVisible:true,text:"Explain the difference between a class and an object",skin:"sknlbltmp"},"flxQA2":{isVisible:false},"flxA":{isVisible:true},"lblA":{isVisible:true,text:"Is answer",skin:"sknlbltmpans"},"imgArrow":{isVisible:true,src:"forward.png"}};
segarray.push(obj);
}
frmQA.Seg.setData(segarray);
}
OUTPUT:
Tuesday, November 27, 2018
Add list data in dynamically
var Receiverdetail = {};
function addMngrlist(){
var SessionId = kony.store.getItem("usersessionid");
var serviceName = "Listoutbyusertype";
var serviceType = "online";
var objSvc = kony.sdk.getCurrentInstance().getObjectService(serviceName, {"access": serviceType});
var objectName = "";
var dataObject = "";
if(kony.store.getItem("sessionuserLogin").usertype === 1 || kony.store.getItem("sessionuserLogin").usertype === "1"){
objectName = "listoutforemployee";
dataObject = new kony.sdk.dto.DataObject(objectName);
dataObject.odataUrl = "$filter=emptype ne 1";
}
if(kony.store.getItem("sessionuserLogin").usertype === 2 || kony.store.getItem("sessionuserLogin").usertype === "2"){
objectName = "listoutforManager";
dataObject = new kony.sdk.dto.DataObject(objectName);
dataObject.odataUrl = "$filter=emptype eq 3";
}
var options = {"dataObject":dataObject};
objSvc.fetch(options, OSListManagerandceo, ONFailureListManagerandceo);
}
function OSListManagerandceo(res){
var i = 0;
Arrayoflist = [];
if(((res.records).length) >0){
for(i = 0;i < (res.records).length;i++){
if(((res.records)[i]).emptype === "2" || ((res.records)[i]).emptype === 2){
Arrayoflist.push([parseInt(((res.records)[i]).id),((res.records)[i]).empname + "(Manager)"]);
}
if(((res.records)[i]).emptype === "3" || ((res.records)[i]).emptype === 3){
Arrayoflist.push([parseInt(((res.records)[i]).id),((res.records)[i]).empname + "(CEO)"]);
}
}
}else{
if(kony.store.getItem("sessionuserLogin").usertype === 1 || kony.store.getItem("sessionuserLogin").usertype === "1"){
Arrayoflist.push(["","Select Manager/CEO"]);
}else if(kony.store.getItem("sessionuserLogin").usertype === 2 || kony.store.getItem("sessionuserLogin").usertype === "2"){
Arrayoflist.push(["","Select CEO"]);
}
}
if(kony.application.getCurrentForm().id === "frmRequest"){
frmRequest.lstmanager.masterData = Arrayoflist;
}else if(kony.application.getCurrentForm().id === "frmMedical"){
frmMedical.lstmanager.masterData = Arrayoflist;
}else if(kony.application.getCurrentForm().id === "frmTravel"){
frmTravel.lstmanager.masterData = Arrayoflist;
}
}
function ONFailureListManagerandceo(res){
alert("failuer in listoutforemployee" + JSON.stringify(res));
}
function addMngrlist(){
var SessionId = kony.store.getItem("usersessionid");
var serviceName = "Listoutbyusertype";
var serviceType = "online";
var objSvc = kony.sdk.getCurrentInstance().getObjectService(serviceName, {"access": serviceType});
var objectName = "";
var dataObject = "";
if(kony.store.getItem("sessionuserLogin").usertype === 1 || kony.store.getItem("sessionuserLogin").usertype === "1"){
objectName = "listoutforemployee";
dataObject = new kony.sdk.dto.DataObject(objectName);
dataObject.odataUrl = "$filter=emptype ne 1";
}
if(kony.store.getItem("sessionuserLogin").usertype === 2 || kony.store.getItem("sessionuserLogin").usertype === "2"){
objectName = "listoutforManager";
dataObject = new kony.sdk.dto.DataObject(objectName);
dataObject.odataUrl = "$filter=emptype eq 3";
}
var options = {"dataObject":dataObject};
objSvc.fetch(options, OSListManagerandceo, ONFailureListManagerandceo);
}
function OSListManagerandceo(res){
var i = 0;
Arrayoflist = [];
if(((res.records).length) >0){
for(i = 0;i < (res.records).length;i++){
if(((res.records)[i]).emptype === "2" || ((res.records)[i]).emptype === 2){
Arrayoflist.push([parseInt(((res.records)[i]).id),((res.records)[i]).empname + "(Manager)"]);
}
if(((res.records)[i]).emptype === "3" || ((res.records)[i]).emptype === 3){
Arrayoflist.push([parseInt(((res.records)[i]).id),((res.records)[i]).empname + "(CEO)"]);
}
}
}else{
if(kony.store.getItem("sessionuserLogin").usertype === 1 || kony.store.getItem("sessionuserLogin").usertype === "1"){
Arrayoflist.push(["","Select Manager/CEO"]);
}else if(kony.store.getItem("sessionuserLogin").usertype === 2 || kony.store.getItem("sessionuserLogin").usertype === "2"){
Arrayoflist.push(["","Select CEO"]);
}
}
if(kony.application.getCurrentForm().id === "frmRequest"){
frmRequest.lstmanager.masterData = Arrayoflist;
}else if(kony.application.getCurrentForm().id === "frmMedical"){
frmMedical.lstmanager.masterData = Arrayoflist;
}else if(kony.application.getCurrentForm().id === "frmTravel"){
frmTravel.lstmanager.masterData = Arrayoflist;
}
}
function ONFailureListManagerandceo(res){
alert("failuer in listoutforemployee" + JSON.stringify(res));
}
basic coding standard
Widget Prefix
HBox hbx
VBox vbx
TabPane tbp
Tab tab
Label lbl
Button btn
Browser brws
TextBox txt
TextArea txa
Calendar cal
ComboBox cmb
ListBox lst
CheckBoxGroup chk
RadioButtonGroup rbt
Link lnk
Line lin
Image img
MenuItem mnu
Segment seg
ImageGallery igl
HorizontalImageStrip his
Phone phn
Camera cam
Switch swt
PickerView pkv
hide load indicator by this
kony.application.setApplicationBehaviors({ "hideDefaultLoadingIndicator":true});
try below this one also
Form1.FlexPopup.isModalContainer = true;
Using finger touch with this function
function isAuthUsingTouchSupported()
{
var status = kony.localAuthentication.getStatusForAuthenticationMode(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID);
if(status == 5000)
{
alert("Touch ID for FingerPrint Sample ");
authUsingTouchID();
}
else
{
var msg = "Touch ID is not configured on this device.Authentication returned a status ::"+status;
kony.ui.Alert({message: msg+" "+status,
alertType: constants.ALERT_TYPE_INFO,
yesLabel:"Close"},
{});
}
}
function statusCB(status,message)
{
if(status == 5000)
{
frmAddAccount.show();
}
else if(status == 5001)
{
alert("try again");
}
else
{
var messg = status+": "+message;
kony.ui.Alert({message: messg,
alertType: constants.ALERT_TYPE_INFO,
yesLabel:"Close"},
{});
}
}
function authUsingTouchID()
{
var config = {"promptMessage" : "PLEASE AUTHENTICATE USING YOUR TOUCH ID"};
kony.localAuthentication.authenticate(
constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID,statusCB,config);
}
{
var status = kony.localAuthentication.getStatusForAuthenticationMode(constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID);
if(status == 5000)
{
alert("Touch ID for FingerPrint Sample ");
authUsingTouchID();
}
else
{
var msg = "Touch ID is not configured on this device.Authentication returned a status ::"+status;
kony.ui.Alert({message: msg+" "+status,
alertType: constants.ALERT_TYPE_INFO,
yesLabel:"Close"},
{});
}
}
function statusCB(status,message)
{
if(status == 5000)
{
frmAddAccount.show();
}
else if(status == 5001)
{
alert("try again");
}
else
{
var messg = status+": "+message;
kony.ui.Alert({message: messg,
alertType: constants.ALERT_TYPE_INFO,
yesLabel:"Close"},
{});
}
}
function authUsingTouchID()
{
var config = {"promptMessage" : "PLEASE AUTHENTICATE USING YOUR TOUCH ID"};
kony.localAuthentication.authenticate(
constants.LOCAL_AUTHENTICATION_MODE_TOUCH_ID,statusCB,config);
}
Monday, November 26, 2018
secure text entry call form preshow
frmname.widgetid.secureTextEntry=true;
common alert syntax with sample
function validated(){
if(frmTest.text1.text === null || frmTest.text1.text === "" || frmTest.text1.text === undefined || frmTest.text1.text === " "){
CommonAlrt("Please Enter text");
}
}
function CommonAlrt(response)
{
var basicConf = {message: response,alertType: constants.ALERT_TYPE_CONFIRMATION,alertTitle: "Sample Alert",yesLabel:"yes",
noLabel: "no", alertHandler: alertres};
var pspConf = {};
var infoAlert = kony.ui.Alert(basicConf,pspConf);
}
function alertres(response){
if(response){
alert("its working yes");
}else{
return false;
}
}
if(frmTest.text1.text === null || frmTest.text1.text === "" || frmTest.text1.text === undefined || frmTest.text1.text === " "){
CommonAlrt("Please Enter text");
}
}
function CommonAlrt(response)
{
var basicConf = {message: response,alertType: constants.ALERT_TYPE_CONFIRMATION,alertTitle: "Sample Alert",yesLabel:"yes",
noLabel: "no", alertHandler: alertres};
var pspConf = {};
var infoAlert = kony.ui.Alert(basicConf,pspConf);
}
function alertres(response){
if(response){
alert("its working yes");
}else{
return false;
}
}
Over basic widget from get value and doreset it
var arrlist =[];
var OnSelecteddate = false;
function validte(rsponse){
if(rsponse === null || rsponse === "" || rsponse ===" "|| rsponse === undefined){
return true;
}else{
return false;
}
}
function OnValidateDetail(){
if(kony.store.getItem("AUDetails") !== null){
arrlist = kony.store.getItem("AUDetails");
}
if(validte(frmRegistor.txtName.text)){
alert("Please enter username");
frmRegistor.txtName.setFocus(true);
return false;
}
if(validte(frmRegistor.txtPW.text)){
alert("Please enter password");
frmRegistor.txtPW.setFocus(true);
return false;
}
if(validte(frmRegistor.txtCPW.text)){
alert("Please enter confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(frmRegistor.txtPW.text !== frmRegistor.txtCPW.text){
alert("Please check confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(validte(frmRegistor.rbtGender.selectedKeyValue)){
alert("Please select gender");
frmRegistor.rbtGender.setFocus(true);
return false;
}
if(OnSelecteddate === false){
var currentdate = new Date();
//OnSelecteddate = true;
}
if(validte(frmRegistor.txABOX.text)){
alert("Please select address");
frmRegistor.txABOX.setFocus(true);
return false;
}
var a = "";
if(frmRegistor.CHKBox.selectedKeyValues !== null){
for(var i = 0; i< frmRegistor.CHKBox.selectedKeyValues.length; i++){
if(a.length >0){
a += "/";
}
a += frmRegistor.CHKBox.selectedKeyValues[i][1];
}
}else if(frmRegistor.CHKBox.selectedKeyValues === null){
alert("Please select Skill");
return false;
}
if(validte(frmRegistor.rchtxtBox.text)){
alert("Please enter richtext");
frmRegistor.rchtxtBox.setFocus(true);
return false;
}
if(frmRegistor.lstBox.selectedKey === "Wish0"){
alert("Please select option");
frmRegistor.lstBox.setFocus(true);
return false;
}
if(frmRegistor.sldbox.selectedValue === "0"){
alert("Please give rating 0 above");
frmRegistor.sldbox.setFocus(true);
return false;
}
if(validte(frmRegistor.pckrDate.selectedKeyValues[2][1])){
alert("Please select rating above of zero");
frmRegistor.pckrDate.setFocus(true);
return false;
}
if(validte(frmRegistor.imageshow.base64)){
alert("Please Update profile picture");
return false;
}
frmDetailofRegistor.lblNAME.text = frmRegistor.txtName.text;
frmDetailofRegistor.lblgender.text = frmRegistor.rbtGender.selectedKeyValue[1];
frmDetailofRegistor.lbladr.text = frmRegistor.txABOX.text;
frmDetailofRegistor.lblSkills.text = a;
frmDetailofRegistor.txtrichConvert.text =frmRegistor.rchtxtBox.text;
frmDetailofRegistor.lblOption.text = frmRegistor.lstBox.selectedKeyValue[1];
frmDetailofRegistor.lblrating.text = frmRegistor.sldbox.selectedValue;
if(frmRegistor.btnswitch.selectedIndex === 0.0){
frmDetailofRegistor.lblWilling.text = "Willing";
}else{
frmDetailofRegistor.lblWilling.text = "Not Willing";
}
frmDetailofRegistor.lblEntryDate.text = frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1];
var obj ={ "Uimg":frmRegistor.imageshow.base64,"Uname":frmRegistor.txtName.text,"Upw":frmRegistor.txtPW.text,
"Ucpw":frmRegistor.txtCPW.text,"Ugender":frmRegistor.rbtGender.selectedKeyValue[1],"Udob":frmDetailofRegistor.lblADOB.text,
"Uaddress":frmRegistor.txABOX.text,"Uskills":a,"Urichtext":frmRegistor.rchtxtBox.text,
"Uoption": frmRegistor.lstBox.selectedKeyValue[1],"Urating":frmRegistor.sldbox.selectedValue,"Uwilling":frmDetailofRegistor.lblWilling.text,
"Uentrydate":frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1],
"IsActive":false};
arrlist.push(obj);
kony.store.setItem("AUDetails", arrlist);
frmLogin.show();
return false;
}
function onSelection(evenobj){
frmDetailofRegistor.lblADOB.text = evenobj.day + "/" + evenobj.month + "/" +evenobj.year;
OnSelecteddate = true;
}
function imgFetchMedia(){
var querycontext = {mimetype:"image/*"};
var Status = kony.phone.openMediaGallery(onselectioncallback, querycontext);
function onselectioncallback(rawBytes)
{
if (rawBytes === null){
alert("please select images");
}else{
var base64Str = kony.convertToBase64(rawBytes);
frmRegistor.imageshow.base64 = base64Str;
frmDetailofRegistor.imageofuser.base64 = base64Str;
}
}
}
function img(){
var rawbytes = frmRegistor.cameraid.rawBytes;
var base64Str = kony.convertToBase64(rawbytes);
frmRegistor.imageshow.base64 = base64Str;
frmDetailofRegistor.imageofuser.base64 = base64Str;
}
function doresetR(){
frmRegistor.imageshow.src="";
frmRegistor.txtName.text ="";
frmRegistor.txtPW.text ="";
frmRegistor.txtCPW.text ="";
frmRegistor.txABOX.text="";
frmRegistor.lstBox.selectedKey = "Wish0";
frmRegistor.rbtGender.selectedKey ="rbg1";
frmRegistor.sldbox.selectedValue ="0";
frmRegistor.CHKBox.selectedKeys = [""];
var currentdate = new Date();
frmRegistor.calBox.dateComponents = currentdate.getDate() +"/"+ currentdate.getMonth() +"/"+ currentdate.getFullYear();
frmRegistor.btnswitch.selectedIndex = 0.0;
frmRegistor.txtName.setFocus(true);
return false;
}
Gesture swipe using method and functions
function myTap(myWidget,gestureInfo)
{
alert(" single finger double tap Gesture detected");
}
function myTapp(myWidget,gestureInfo)
{
alert("double finger single Tap Gesture detected");
}
function mySwip(myWidget,gestureInfo)
{
if(gestureInfo.swipeDirection === 1){
alert("Swiped left");
}
else if(gestureInfo.swipeDirection === 2){
alert("Swiped right");
}
}
function mySwipp(myWidget,gestureInfo)
{
alert(" 2 finger swipe Gesture detected");
}
function myLong(myWidget,gestureInfo)
{
alert("long press Gesture detected");
}
function myLongg(myWidget,gestureInfo)
{
alert(" 8 second long press Gesture detected");
}
function myPinch(myWidget,gestureInfo)
{
alert(" Pinch detect");
}
function myPAN(myWidget,gestureInfo)
{
alert(" Rotation detect");
}
var setupTblTap = {fingers:1,taps:2};
var setupTblTapp = {fingers:2,taps:1};
var setupTblSwip = {fingers: 1, swipeDirection: 1};
var setupTblSwipp = {fingers: 2};
var setupTblLong = {pressDuration:4};
var setupTblLongg = {pressDuration:8};
var setuppinch = {fingers:2, continuousEvents:true};
//var setrotation ={fingers:2, continuousEvents :true};
var setPan ={fingers:1, continuousEvents :true};
function loadonpostshow(){
frmGesture.flxMain.addGestureRecognizer(1,setupTblTap,myTap);
frmGesture.flxMain.addGestureRecognizer(1,setupTblTapp,myTapp);
frmGesture.flxMain.addGestureRecognizer(2,setupTblSwip,mySwip);
frmGesture.flxMain.addGestureRecognizer(2,setupTblSwipp,mySwipp);
frmGesture.flxMain.addGestureRecognizer(3,setupTblLong,myLong);
frmGesture.flxMain.addGestureRecognizer(3,setupTblLong,myLongg);
frmGesture.flxMain.addGestureRecognizer(6,setuppinch,myPinch);
frmGesture.flxMain.img.addGestureRecognizer(4,setPan,myPAN);
}
{
alert(" single finger double tap Gesture detected");
}
function myTapp(myWidget,gestureInfo)
{
alert("double finger single Tap Gesture detected");
}
function mySwip(myWidget,gestureInfo)
{
if(gestureInfo.swipeDirection === 1){
alert("Swiped left");
}
else if(gestureInfo.swipeDirection === 2){
alert("Swiped right");
}
}
function mySwipp(myWidget,gestureInfo)
{
alert(" 2 finger swipe Gesture detected");
}
function myLong(myWidget,gestureInfo)
{
alert("long press Gesture detected");
}
function myLongg(myWidget,gestureInfo)
{
alert(" 8 second long press Gesture detected");
}
function myPinch(myWidget,gestureInfo)
{
alert(" Pinch detect");
}
function myPAN(myWidget,gestureInfo)
{
alert(" Rotation detect");
}
var setupTblTap = {fingers:1,taps:2};
var setupTblTapp = {fingers:2,taps:1};
var setupTblSwip = {fingers: 1, swipeDirection: 1};
var setupTblSwipp = {fingers: 2};
var setupTblLong = {pressDuration:4};
var setupTblLongg = {pressDuration:8};
var setuppinch = {fingers:2, continuousEvents:true};
//var setrotation ={fingers:2, continuousEvents :true};
var setPan ={fingers:1, continuousEvents :true};
function loadonpostshow(){
frmGesture.flxMain.addGestureRecognizer(1,setupTblTap,myTap);
frmGesture.flxMain.addGestureRecognizer(1,setupTblTapp,myTapp);
frmGesture.flxMain.addGestureRecognizer(2,setupTblSwip,mySwip);
frmGesture.flxMain.addGestureRecognizer(2,setupTblSwipp,mySwipp);
frmGesture.flxMain.addGestureRecognizer(3,setupTblLong,myLong);
frmGesture.flxMain.addGestureRecognizer(3,setupTblLong,myLongg);
frmGesture.flxMain.addGestureRecognizer(6,setuppinch,myPinch);
frmGesture.flxMain.img.addGestureRecognizer(4,setPan,myPAN);
}
call above function loadonpostshow() which page you want to use
App basic API with function sample
//Type your code here
function getcurfrm(){
alert(kony.application.getCurrentForm().id);
return false;
}
function getprefrm(){
alert(kony.application.getPreviousForm().id);
return false;
}
function getshowload(){
kony.application.showLoadingScreen("sknloading","Loading...",constants.
LOADING_SCREEN_POSITION_ONLY_CENTER, false,true,{enableMenuKey:true,
enableBackKey:true, progressIndicatorColor : "ffffff77"});
}
function gethideload(){
kony.application.dismissLoadingScreen();
}
function openURLshow()
{
//Accessing an external web page : http://www.google.com
kony.application.openURL("http://hitechkd.blogspot.com/");
}
function exitappli()
{
try{
kony.application.exit();
}
catch(Error)
{
alert("Exception While getting exiting the application : "+Error);
}
}
function OSfreeM()
{
var freememory = kony.os.freeMemory();
alert(freememory);
}
function OSDinfo()
{
var deviceInfo = kony.os.deviceInfo();
for (var key in deviceInfo)
{
if(key === "version"){
DeviceinfoPopup.LlblVersion.text =deviceInfo[key];
}
if(key === "deviceHeight"){
DeviceinfoPopup.LlblDeviceHieght.text =deviceInfo[key];
}
if(key === "deviceWidth"){
DeviceinfoPopup.LlblDeviceWidth.text =deviceInfo[key];
}
if(key === "name"){
DeviceinfoPopup.LlblName.text =deviceInfo[key];
}
if(key === "model"){
DeviceinfoPopup.LlblModel.text =deviceInfo[key];
}
}
DeviceinfoPopup.show();
}
function popupdismis(){
DeviceinfoPopup.dismiss();
}
function OSDGPS()
{
alert(kony.os.hasGPSSupport());
}
function OSCAMRA()
{
alert(kony.os.hasCameraSupport());
}
function OSTOUCH()
{
alert(kony.os.hasTouchSupport());
}
var i = 0;
function timerFuncstart() //nested function
{
timercallbackcancel();
i = i+1;
frmtimer.lbltimer.text = i+" secs ";
}
function strat(){
kony.timer.schedule("mytimer12",timerFuncstart, 5, true);
}
//nested function
function setcall1(){
i = 0;
frmtimer.lbltimer.text = i+" secs";
}
function timerFuncCallBack()
{
alert("innovike");
kony.timer.setCallBack("mytimer12",setcall1);
}
function timercallbackcancel()
{
try
{
kony.timer.cancel("mytimer12");
}
catch(err)
{
alert("error in second button onclick and err is:: "+err);
}
}
function getcurfrm(){
alert(kony.application.getCurrentForm().id);
return false;
}
function getprefrm(){
alert(kony.application.getPreviousForm().id);
return false;
}
function getshowload(){
kony.application.showLoadingScreen("sknloading","Loading...",constants.
LOADING_SCREEN_POSITION_ONLY_CENTER, false,true,{enableMenuKey:true,
enableBackKey:true, progressIndicatorColor : "ffffff77"});
}
function gethideload(){
kony.application.dismissLoadingScreen();
}
function openURLshow()
{
//Accessing an external web page : http://www.google.com
kony.application.openURL("http://hitechkd.blogspot.com/");
}
function exitappli()
{
try{
kony.application.exit();
}
catch(Error)
{
alert("Exception While getting exiting the application : "+Error);
}
}
function OSfreeM()
{
var freememory = kony.os.freeMemory();
alert(freememory);
}
function OSDinfo()
{
var deviceInfo = kony.os.deviceInfo();
for (var key in deviceInfo)
{
if(key === "version"){
DeviceinfoPopup.LlblVersion.text =deviceInfo[key];
}
if(key === "deviceHeight"){
DeviceinfoPopup.LlblDeviceHieght.text =deviceInfo[key];
}
if(key === "deviceWidth"){
DeviceinfoPopup.LlblDeviceWidth.text =deviceInfo[key];
}
if(key === "name"){
DeviceinfoPopup.LlblName.text =deviceInfo[key];
}
if(key === "model"){
DeviceinfoPopup.LlblModel.text =deviceInfo[key];
}
}
DeviceinfoPopup.show();
}
function popupdismis(){
DeviceinfoPopup.dismiss();
}
function OSDGPS()
{
alert(kony.os.hasGPSSupport());
}
function OSCAMRA()
{
alert(kony.os.hasCameraSupport());
}
function OSTOUCH()
{
alert(kony.os.hasTouchSupport());
}
var i = 0;
function timerFuncstart() //nested function
{
timercallbackcancel();
i = i+1;
frmtimer.lbltimer.text = i+" secs ";
}
function strat(){
kony.timer.schedule("mytimer12",timerFuncstart, 5, true);
}
//nested function
function setcall1(){
i = 0;
frmtimer.lbltimer.text = i+" secs";
}
function timerFuncCallBack()
{
alert("innovike");
kony.timer.setCallBack("mytimer12",setcall1);
}
function timercallbackcancel()
{
try
{
kony.timer.cancel("mytimer12");
}
catch(err)
{
alert("error in second button onclick and err is:: "+err);
}
}
NFI deep link sample
function NFIfunctiondeep()
{
try{
var intent = java.import("android.content.Intent");
var KonyMain = java.import("com.konylabs.android.KonyMain");
intent = KonyMain.getAppContext().getPackageManager().getLaunchIntentForPackage("com.orgname.NadikaKart");
KonyMain.getAppContext().startActivity(intent);
}catch(error)
{
alert(error);
}
}
{
try{
var intent = java.import("android.content.Intent");
var KonyMain = java.import("com.konylabs.android.KonyMain");
intent = KonyMain.getAppContext().getPackageManager().getLaunchIntentForPackage("com.orgname.NadikaKart");
KonyMain.getAppContext().startActivity(intent);
}catch(error)
{
alert(error);
}
}
Search by WIDGET in segment
function getSearchResult(mData, searchValue) {
if(ArrayofRequestlistseg !== null){
var arr3 =[];
arr3 = ArrayofRequestlistseg;
var length = arr3.length;
var sData = [];
for ( i = 0; i < length; i++) {
if (arr3[i].lblToMangerEmpId !== null || arr3[i].lblToMangerEmpId !== undefined) {
var txt1 = "";
if (arr3[i].lblToMangerEmpId !== null && arr3[i].lblToMangerEmpId !== undefined) {
txt1 = arr3[i].lblToMangerEmpId;
}
var pattern = searchValue.text.trim().toUpperCase();
if (txt1.toUpperCase().search(pattern) !== -1) {
sData.push(arr3[i]);
}
}
}
if(sData.length > 0){
frmDashboard.segmentmain.setData(sData);
}else{
sData = [];
frmDashboard.segmentmain.setData(sData);
}
}else{
return false;
}
}
function refreshseg(){
frmDashboard.txtSearchEmpID.text ="";
if(ArrayofRequestlistseg !== null){
var arr2 =[];
arr2 = ArrayofRequestlistseg;
frmDashboard.segmentmain.setData(arr2);
}
}
if(ArrayofRequestlistseg !== null){
var arr3 =[];
arr3 = ArrayofRequestlistseg;
var length = arr3.length;
var sData = [];
for ( i = 0; i < length; i++) {
if (arr3[i].lblToMangerEmpId !== null || arr3[i].lblToMangerEmpId !== undefined) {
var txt1 = "";
if (arr3[i].lblToMangerEmpId !== null && arr3[i].lblToMangerEmpId !== undefined) {
txt1 = arr3[i].lblToMangerEmpId;
}
var pattern = searchValue.text.trim().toUpperCase();
if (txt1.toUpperCase().search(pattern) !== -1) {
sData.push(arr3[i]);
}
}
}
if(sData.length > 0){
frmDashboard.segmentmain.setData(sData);
}else{
sData = [];
frmDashboard.segmentmain.setData(sData);
}
}else{
return false;
}
}
function refreshseg(){
frmDashboard.txtSearchEmpID.text ="";
if(ArrayofRequestlistseg !== null){
var arr2 =[];
arr2 = ArrayofRequestlistseg;
frmDashboard.segmentmain.setData(arr2);
}
}
Map function
function getPosition(){
try{
var positionoptions = {timeout: 15000};
frmMap.mapaddress.zoomLevel=15;
kony.location.getCurrentPosition(successcallback, errorcallback, positionoptions);
}catch(error)
{
alert("error"+error);
}
}
function successcallback(position){
try{
var lat = position.coords.latitude;
var long = position.coords.longitude;
var locationData = [{
lat: lat,
lon : long,
image : "dest.png",
desc: "your location",
name: "location"
}];
frmMap.mapaddress.locationData = locationData;
}catch(error)
{
alert("error"+error);
}
}
function errorcallback(positionerror){
try{
var errorMesg = "Error code: " + positionerror.code;
errorMesg = errorMesg + " message: " + positionerror.message;
alert(errorMesg);
}catch(error)
{
alert("error"+error);
}
}
try{
var positionoptions = {timeout: 15000};
frmMap.mapaddress.zoomLevel=15;
kony.location.getCurrentPosition(successcallback, errorcallback, positionoptions);
}catch(error)
{
alert("error"+error);
}
}
function successcallback(position){
try{
var lat = position.coords.latitude;
var long = position.coords.longitude;
var locationData = [{
lat: lat,
lon : long,
image : "dest.png",
desc: "your location",
name: "location"
}];
frmMap.mapaddress.locationData = locationData;
}catch(error)
{
alert("error"+error);
}
}
function errorcallback(positionerror){
try{
var errorMesg = "Error code: " + positionerror.code;
errorMesg = errorMesg + " message: " + positionerror.message;
alert(errorMesg);
}catch(error)
{
alert("error"+error);
}
}
Kony call function
function call()
{
try{
var Intent = java.import("android.content.Intent");
var KonyMain = java.import("com.konylabs.android.KonyMain");
var uri = java.import("android.net.Uri");
// var launchIntent = getPackageManager().getLaunchIntentForPackage("com.orgname.firstLogin");
var intent = new Intent(Intent.ACTION_CALL);
intent.setData(uri.parse("tel:" + ___________));//change the number
KonyMain.getAppContext().startActivity(intent);
}catch(err){
alert("Error "+JSON.stringify(err));
}
}
{
try{
var Intent = java.import("android.content.Intent");
var KonyMain = java.import("com.konylabs.android.KonyMain");
var uri = java.import("android.net.Uri");
// var launchIntent = getPackageManager().getLaunchIntentForPackage("com.orgname.firstLogin");
var intent = new Intent(Intent.ACTION_CALL);
intent.setData(uri.parse("tel:" + ___________));//change the number
KonyMain.getAppContext().startActivity(intent);
}catch(err){
alert("Error "+JSON.stringify(err));
}
}
show in pic Image tag
function img(){
var rawbytes = frmRegistor.cameraid.rawBytes;
var base64Str = kony.convertToBase64(rawbytes);
frmRegistor.imageshow.base64 = base64Str;
frmDetailofRegistor.imageofuser.base64 = base64Str;
}
var rawbytes = frmRegistor.cameraid.rawBytes;
var base64Str = kony.convertToBase64(rawbytes);
frmRegistor.imageshow.base64 = base64Str;
frmDetailofRegistor.imageofuser.base64 = base64Str;
}
Kony Store using for array store
Set value in kony store setitem:
var obj ={ "Uimg":frmRegistor.imageshow.base64,"Uname":frmRegistor.txtName.text,"Upw":frmRegistor.txtPW.text,
"Ucpw":frmRegistor.txtCPW.text,"Ugender":frmRegistor.rbtGender.selectedKeyValue[1],"Udob":frmDetailofRegistor.lblADOB.text,
"Uaddress":frmRegistor.txABOX.text,"Uskills":a,"Urichtext":frmRegistor.rchtxtBox.text,
"Uoption": frmRegistor.lstBox.selectedKeyValue[1],"Urating":frmRegistor.sldbox.selectedValue,"Uwilling":frmDetailofRegistor.lblWilling.text,
"Uentrydate":frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1],
"IsActive":false};
arrlist.push(obj);
kony.store.setItem("AUDetails", arrlist);
Get value in kony store getitem:
kony.store.getItem("AUDetails");
Kony loader Operation
Show:
function getshowload(){
kony.application.showLoadingScreen("sknloading","Loading...",constants.
LOADING_SCREEN_POSITION_ONLY_CENTER, false,true,{enableMenuKey:true,
enableBackKey:true, progressIndicatorColor : "ffffff77"});
}
Dismiss:
function gethideload(){
kony.application.dismissLoadingScreen();
}
function getshowload(){
kony.application.showLoadingScreen("sknloading","Loading...",constants.
LOADING_SCREEN_POSITION_ONLY_CENTER, false,true,{enableMenuKey:true,
enableBackKey:true, progressIndicatorColor : "ffffff77"});
}
Dismiss:
function gethideload(){
kony.application.dismissLoadingScreen();
}
Kony Popup Operation for device show
Show Popup:
function OSDinfo()
{
var deviceInfo = kony.os.deviceInfo();
for (var key in deviceInfo)
{
if(key === "version"){
DeviceinfoPopup.LlblVersion.text =deviceInfo[key];
}
if(key === "deviceHeight"){
DeviceinfoPopup.LlblDeviceHieght.text =deviceInfo[key];
}
if(key === "deviceWidth"){
DeviceinfoPopup.LlblDeviceWidth.text =deviceInfo[key];
}
if(key === "name"){
DeviceinfoPopup.LlblName.text =deviceInfo[key];
}
if(key === "model"){
DeviceinfoPopup.LlblModel.text =deviceInfo[key];
}
}
DeviceinfoPopup.show();
}
Dismiss Popup:
function popupdismis(){
DeviceinfoPopup.dismiss();
}
function OSDinfo()
{
var deviceInfo = kony.os.deviceInfo();
for (var key in deviceInfo)
{
if(key === "version"){
DeviceinfoPopup.LlblVersion.text =deviceInfo[key];
}
if(key === "deviceHeight"){
DeviceinfoPopup.LlblDeviceHieght.text =deviceInfo[key];
}
if(key === "deviceWidth"){
DeviceinfoPopup.LlblDeviceWidth.text =deviceInfo[key];
}
if(key === "name"){
DeviceinfoPopup.LlblName.text =deviceInfo[key];
}
if(key === "model"){
DeviceinfoPopup.LlblModel.text =deviceInfo[key];
}
}
DeviceinfoPopup.show();
}
Dismiss Popup:
function popupdismis(){
DeviceinfoPopup.dismiss();
}
Kony Timer
Set Function:
//nested function
function setcall1(){
i = 0;
frmtimer.lbltimer.text = i+" secs";
}
Call back Function:
function timerFuncCallBack()
{
alert("innovike");
kony.timer.setCallBack("mytimer12",setcall1);
}
Callback Cancel Function:
function timercallbackcancel()
{
try
{
kony.timer.cancel("mytimer12");
}
catch(err)
{
alert("error in second button onclick and err is:: "+err);
}
}
//nested function
function setcall1(){
i = 0;
frmtimer.lbltimer.text = i+" secs";
}
Call back Function:
function timerFuncCallBack()
{
alert("innovike");
kony.timer.setCallBack("mytimer12",setcall1);
}
Callback Cancel Function:
function timercallbackcancel()
{
try
{
kony.timer.cancel("mytimer12");
}
catch(err)
{
alert("error in second button onclick and err is:: "+err);
}
}
Fetch data from basic widget and show it on Segment
Call it while Submit form button:
function OnValidateDetail(){
if(kony.store.getItem("AUDetails") !== null){
arrlist = kony.store.getItem("AUDetails");
}
if(validte(frmRegistor.txtName.text)){
alert("Please enter username");
frmRegistor.txtName.setFocus(true);
return false;
}
if(validte(frmRegistor.txtPW.text)){
alert("Please enter password");
frmRegistor.txtPW.setFocus(true);
return false;
}
if(validte(frmRegistor.txtCPW.text)){
alert("Please enter confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(frmRegistor.txtPW.text !== frmRegistor.txtCPW.text){
alert("Please check confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(validte(frmRegistor.rbtGender.selectedKeyValue)){
alert("Please select gender");
frmRegistor.rbtGender.setFocus(true);
return false;
}
if(OnSelecteddate === false){
var currentdate = new Date();
frmDetailofRegistor.lblADOB.text = currentdate.getDate() +"/"+ currentdate.getMonth() +"/"+ currentdate.getFullYear();
//OnSelecteddate = true;
}
if(validte(frmRegistor.txABOX.text)){
alert("Please select address");
frmRegistor.txABOX.setFocus(true);
return false;
}
var a = "";
if(frmRegistor.CHKBox.selectedKeyValues !== null){
for(var i = 0; i< frmRegistor.CHKBox.selectedKeyValues.length; i++){
if(a.length >0){
a += "/";
}
a += frmRegistor.CHKBox.selectedKeyValues[i][1];
}
}else if(frmRegistor.CHKBox.selectedKeyValues === null){
alert("Please select Skill");
return false;
}
if(validte(frmRegistor.rchtxtBox.text)){
alert("Please enter richtext");
frmRegistor.rchtxtBox.setFocus(true);
return false;
}
if(frmRegistor.lstBox.selectedKey === "Wish0"){
alert("Please select option");
frmRegistor.lstBox.setFocus(true);
return false;
}
if(frmRegistor.sldbox.selectedValue === "0"){
alert("Please give rating 0 above");
frmRegistor.sldbox.setFocus(true);
return false;
}
if(validte(frmRegistor.pckrDate.selectedKeyValues[2][1])){
alert("Please select rating above of zero");
frmRegistor.pckrDate.setFocus(true);
return false;
}
if(validte(frmRegistor.imageshow.base64)){
alert("Please Update profile picture");
return false;
}
frmDetailofRegistor.lblNAME.text = frmRegistor.txtName.text;
frmDetailofRegistor.lblgender.text = frmRegistor.rbtGender.selectedKeyValue[1];
frmDetailofRegistor.lbladr.text = frmRegistor.txABOX.text;
frmDetailofRegistor.lblSkills.text = a;
frmDetailofRegistor.txtrichConvert.text =frmRegistor.rchtxtBox.text;
frmDetailofRegistor.lblOption.text = frmRegistor.lstBox.selectedKeyValue[1];
frmDetailofRegistor.lblrating.text = frmRegistor.sldbox.selectedValue;
if(frmRegistor.btnswitch.selectedIndex === 0.0){
frmDetailofRegistor.lblWilling.text = "Willing";
}else{
frmDetailofRegistor.lblWilling.text = "Not Willing";
}
frmDetailofRegistor.lblEntryDate.text = frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1];
var obj ={ "Uimg":frmRegistor.imageshow.base64,"Uname":frmRegistor.txtName.text,"Upw":frmRegistor.txtPW.text,
"Ucpw":frmRegistor.txtCPW.text,"Ugender":frmRegistor.rbtGender.selectedKeyValue[1],"Udob":frmDetailofRegistor.lblADOB.text,
"Uaddress":frmRegistor.txABOX.text,"Uskills":a,"Urichtext":frmRegistor.rchtxtBox.text,
"Uoption": frmRegistor.lstBox.selectedKeyValue[1],"Urating":frmRegistor.sldbox.selectedValue,"Uwilling":frmDetailofRegistor.lblWilling.text,
"Uentrydate":frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1],
"IsActive":false};
arrlist.push(obj);
kony.store.setItem("AUDetails", arrlist);
frmLogin.show();
return false;
}
function OnValidateDetail(){
if(kony.store.getItem("AUDetails") !== null){
arrlist = kony.store.getItem("AUDetails");
}
if(validte(frmRegistor.txtName.text)){
alert("Please enter username");
frmRegistor.txtName.setFocus(true);
return false;
}
if(validte(frmRegistor.txtPW.text)){
alert("Please enter password");
frmRegistor.txtPW.setFocus(true);
return false;
}
if(validte(frmRegistor.txtCPW.text)){
alert("Please enter confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(frmRegistor.txtPW.text !== frmRegistor.txtCPW.text){
alert("Please check confirm password");
frmRegistor.txtCPW.setFocus(true);
return false;
}
if(validte(frmRegistor.rbtGender.selectedKeyValue)){
alert("Please select gender");
frmRegistor.rbtGender.setFocus(true);
return false;
}
if(OnSelecteddate === false){
var currentdate = new Date();
frmDetailofRegistor.lblADOB.text = currentdate.getDate() +"/"+ currentdate.getMonth() +"/"+ currentdate.getFullYear();
//OnSelecteddate = true;
}
if(validte(frmRegistor.txABOX.text)){
alert("Please select address");
frmRegistor.txABOX.setFocus(true);
return false;
}
var a = "";
if(frmRegistor.CHKBox.selectedKeyValues !== null){
for(var i = 0; i< frmRegistor.CHKBox.selectedKeyValues.length; i++){
if(a.length >0){
a += "/";
}
a += frmRegistor.CHKBox.selectedKeyValues[i][1];
}
}else if(frmRegistor.CHKBox.selectedKeyValues === null){
alert("Please select Skill");
return false;
}
if(validte(frmRegistor.rchtxtBox.text)){
alert("Please enter richtext");
frmRegistor.rchtxtBox.setFocus(true);
return false;
}
if(frmRegistor.lstBox.selectedKey === "Wish0"){
alert("Please select option");
frmRegistor.lstBox.setFocus(true);
return false;
}
if(frmRegistor.sldbox.selectedValue === "0"){
alert("Please give rating 0 above");
frmRegistor.sldbox.setFocus(true);
return false;
}
if(validte(frmRegistor.pckrDate.selectedKeyValues[2][1])){
alert("Please select rating above of zero");
frmRegistor.pckrDate.setFocus(true);
return false;
}
if(validte(frmRegistor.imageshow.base64)){
alert("Please Update profile picture");
return false;
}
frmDetailofRegistor.lblNAME.text = frmRegistor.txtName.text;
frmDetailofRegistor.lblgender.text = frmRegistor.rbtGender.selectedKeyValue[1];
frmDetailofRegistor.lbladr.text = frmRegistor.txABOX.text;
frmDetailofRegistor.lblSkills.text = a;
frmDetailofRegistor.txtrichConvert.text =frmRegistor.rchtxtBox.text;
frmDetailofRegistor.lblOption.text = frmRegistor.lstBox.selectedKeyValue[1];
frmDetailofRegistor.lblrating.text = frmRegistor.sldbox.selectedValue;
if(frmRegistor.btnswitch.selectedIndex === 0.0){
frmDetailofRegistor.lblWilling.text = "Willing";
}else{
frmDetailofRegistor.lblWilling.text = "Not Willing";
}
frmDetailofRegistor.lblEntryDate.text = frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1];
var obj ={ "Uimg":frmRegistor.imageshow.base64,"Uname":frmRegistor.txtName.text,"Upw":frmRegistor.txtPW.text,
"Ucpw":frmRegistor.txtCPW.text,"Ugender":frmRegistor.rbtGender.selectedKeyValue[1],"Udob":frmDetailofRegistor.lblADOB.text,
"Uaddress":frmRegistor.txABOX.text,"Uskills":a,"Urichtext":frmRegistor.rchtxtBox.text,
"Uoption": frmRegistor.lstBox.selectedKeyValue[1],"Urating":frmRegistor.sldbox.selectedValue,"Uwilling":frmDetailofRegistor.lblWilling.text,
"Uentrydate":frmRegistor.pckrDate.selectedKeyValues[2][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[1][1] +"/"+ frmRegistor.pckrDate.selectedKeyValues[0][1],
"IsActive":false};
arrlist.push(obj);
kony.store.setItem("AUDetails", arrlist);
frmLogin.show();
return false;
}
How to specific row add in segment for section
var Arr =[];
var OBJarr =[];
var i = 0;
var Dumarr =[];
function subdat(){
if(validate(frmAdmin.txtPname.text)){
alert("Please enter product");
frmAdmin.txtPname.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype1.text)){
alert("Please enter size option");
frmAdmin.txttype1.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype2.text)){
alert("Please enter size option");
frmAdmin.txttype2.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype3.text)){
alert("Please enter size option");
frmAdmin.txttype3.setFocus(true);
return false;
}
var isexist = false;
var dummyi = 0;
if(Arr.length >0){
for(i =0; i < Arr.length;i++){
if(frmAdmin.txtPname.text === Arr[i][0].lblhdr1.text){
isexist = true;
dummyi = i;
break;
}
}
if(isexist === true){
Arr[dummyi][1].push({"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text});
isexist =false;
dummyi = 0;
}else{
OBJarr.push({"lblhdr1":{text:frmAdmin.txtPname.text,isVisible:true}},[{"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text}]);
Arr.push(OBJarr);
}
}else{
OBJarr.push({"lblhdr1":{text:frmAdmin.txtPname.text,isVisible:true}},[{"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text}]);
Arr.push(OBJarr);
}
OBJarr =[];
frmsec.seg.setData(Arr);
frmAdmin.destroy();
frmsec.show();
}//
function setseg(){
Arr.push([{"lblhdr1":"KAREEM"},[{"LBL1":"FIRST","LBL2":"SECOND"}]]);
frmsec2.seg.setData(Arr);
alert(frmsec2.seg.data);
}
var OBJarr =[];
var i = 0;
var Dumarr =[];
function subdat(){
if(validate(frmAdmin.txtPname.text)){
alert("Please enter product");
frmAdmin.txtPname.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype1.text)){
alert("Please enter size option");
frmAdmin.txttype1.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype2.text)){
alert("Please enter size option");
frmAdmin.txttype2.setFocus(true);
return false;
}
if(validate(frmAdmin.txttype3.text)){
alert("Please enter size option");
frmAdmin.txttype3.setFocus(true);
return false;
}
var isexist = false;
var dummyi = 0;
if(Arr.length >0){
for(i =0; i < Arr.length;i++){
if(frmAdmin.txtPname.text === Arr[i][0].lblhdr1.text){
isexist = true;
dummyi = i;
break;
}
}
if(isexist === true){
Arr[dummyi][1].push({"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text});
isexist =false;
dummyi = 0;
}else{
OBJarr.push({"lblhdr1":{text:frmAdmin.txtPname.text,isVisible:true}},[{"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text}]);
Arr.push(OBJarr);
}
}else{
OBJarr.push({"lblhdr1":{text:frmAdmin.txtPname.text,isVisible:true}},[{"LBL1": frmAdmin.txttype1.text ,"LBL2": frmAdmin.txttype3.text, "LBL3": frmAdmin.txttype3.text}]);
Arr.push(OBJarr);
}
OBJarr =[];
frmsec.seg.setData(Arr);
frmAdmin.destroy();
frmsec.show();
}//
function setseg(){
Arr.push([{"lblhdr1":"KAREEM"},[{"LBL1":"FIRST","LBL2":"SECOND"}]]);
frmsec2.seg.setData(Arr);
alert(frmsec2.seg.data);
}
function for Arithmedic calculator
function ArithCalc(){
var CtxtArea = frmCalc.txtOutput.text;
var arrplus = CtxtArea.split('+');
var arrminus = CtxtArea.split('-');
var arrDivide = CtxtArea.split('/');
var arrPercent = CtxtArea.split('%');
var arrMul = CtxtArea.split('*');
//alert(parseInt(arrminus[0]) - parseInt(arrminus[1]));
if(arrplus.length >0){
frmCalc.txtOutput.text = (parseInt(arrplus[0]) + parseInt(arrplus[1]));
}else if(arrminus.length >0){
frmCalc.txtOutput.text = ""+parseInt(arrminus[0]) - parseInt(arrminus[1]);
}else if(arrDivide.length >0){
frmCalc.txtOutput.text = (parseInt(arrDivide[0]) / parseInt(arrDivide[1]));
}else if(arrPercent.length >0){
frmCalc.txtOutput.text = (parseInt(arrPercent[0]) % parseInt(arrPercent[1]));
} else if(arrMul.length >0){
frmCalc.txtOutput.text = (parseInt(arrMul[0]) * parseInt(arrMul[1]));
}
}
var CtxtArea = frmCalc.txtOutput.text;
var arrplus = CtxtArea.split('+');
var arrminus = CtxtArea.split('-');
var arrDivide = CtxtArea.split('/');
var arrPercent = CtxtArea.split('%');
var arrMul = CtxtArea.split('*');
//alert(parseInt(arrminus[0]) - parseInt(arrminus[1]));
if(arrplus.length >0){
frmCalc.txtOutput.text = (parseInt(arrplus[0]) + parseInt(arrplus[1]));
}else if(arrminus.length >0){
frmCalc.txtOutput.text = ""+parseInt(arrminus[0]) - parseInt(arrminus[1]);
}else if(arrDivide.length >0){
frmCalc.txtOutput.text = (parseInt(arrDivide[0]) / parseInt(arrDivide[1]));
}else if(arrPercent.length >0){
frmCalc.txtOutput.text = (parseInt(arrPercent[0]) % parseInt(arrPercent[1]));
} else if(arrMul.length >0){
frmCalc.txtOutput.text = (parseInt(arrMul[0]) * parseInt(arrMul[1]));
}
}
Call Multiple button in Button click
var index = 0;
function onClickCallBack()
{
//Write your logic here.
//Defining the button with onClick:onClickCallBck.
index +=1;
var btnBasic ={id:"Onbutton", isVisible:true, skin:"sknbtn1", focusSkin:"btnCancel", text:"New Button" + index};
var btnLayout ={containerWeight:100, padding:[5,5,5,5], margin:[10,5,5,5], hExpand:true, vExpand:false, displayText:true};
var btnPSP ={glowEffect:true };
//Creating the button.
var Onbutton1 = new kony.ui.Button(btnBasic, btnLayout, btnPSP);
frmTest.flxMain.add(Onbutton1);
}
function onClickCallBack()
{
//Write your logic here.
//Defining the button with onClick:onClickCallBck.
index +=1;
var btnBasic ={id:"Onbutton", isVisible:true, skin:"sknbtn1", focusSkin:"btnCancel", text:"New Button" + index};
var btnLayout ={containerWeight:100, padding:[5,5,5,5], margin:[10,5,5,5], hExpand:true, vExpand:false, displayText:true};
var btnPSP ={glowEffect:true };
//Creating the button.
var Onbutton1 = new kony.ui.Button(btnBasic, btnLayout, btnPSP);
frmTest.flxMain.add(Onbutton1);
}
Chart create by Code
function chartview()
{
var chartObj = kdv_createColumnChartJSObject();
var chartWidget = new kony.ui.Chart2D3D({
"id": "chartid",
"isVisible": true
}, {
"widgetAlignment": constants.WIDGET_ALIGN_CENTER,
"contentAlignment": constants.CONTENT_ALIGN_MIDDLE_LEFT,
"containerWeight": 100
},
chartObj);
frmChart.flxMain.add(chartWidget);
}
//creating chart object with chart properties and chart data...
function kdv_createColumnChartJSObject()
{
var setofdat = kony.store.getItem("usersessionid");
var setdata = kony.store.getItem("LSArrayDetails")[setofdat].MarkDetailofUser;
//var setofdat = kony.store.getItem("usersessionid");
//kony.store.getItem("LSArrayDetails")[setofdat].MarkDetailofUser;
var chartJSObj ={
"chartProperties":{
"chartHeight": 50,
"drawEntities":["axis","grid","columnChart"],
"columnChart":{
"columnId": [0],
/////// animations
"animations": {
"onInitAnimation": true
},
"graphType": "normal",
"dataAlignToAxis": ["primaryYAxis"],
"plotMissingValues": "assumeZero",
/////// bar config
"bar": {
"width": [400],
"fillType": ["color"],
"transparency": [0],
"gradientType": ["linearTopToBottom"],
"gradientRatios": [
[0, 20, 50, 100]
],
"color": ["0x169EECFF", "0xBE0056ff", "0xFCC40EFF", "0xff0000ff", "0x00ff00ff", "0x0000ffff"],
},
"border": {
"visible": false,
"line": {
"color": ["0xaaaaaaff"],
"width": [1],
"transparency": [0]
}
},
/////// chart datalabels
"dataLabels": {
"visible": true,
"indicators": ["numberValue"],
"separator": "space",
"placement": "inside",
"orientationAngle": 0,
"font": {
"size": [14],
"family": ["Verdana"],
"style": ["Bold"],
"color": ["0xaaaaaaff"],
"transparency": [0]
},
}
}
},
"chartData":{
"columnNames":{
"values":["col1"]
},
"rowNames":{
"values":["10th","12","UG"]
},
"data":{
"col1":setdata
}
}
};
return chartJSObj;
}
{
var chartObj = kdv_createColumnChartJSObject();
var chartWidget = new kony.ui.Chart2D3D({
"id": "chartid",
"isVisible": true
}, {
"widgetAlignment": constants.WIDGET_ALIGN_CENTER,
"contentAlignment": constants.CONTENT_ALIGN_MIDDLE_LEFT,
"containerWeight": 100
},
chartObj);
frmChart.flxMain.add(chartWidget);
}
//creating chart object with chart properties and chart data...
function kdv_createColumnChartJSObject()
{
var setofdat = kony.store.getItem("usersessionid");
var setdata = kony.store.getItem("LSArrayDetails")[setofdat].MarkDetailofUser;
//var setofdat = kony.store.getItem("usersessionid");
//kony.store.getItem("LSArrayDetails")[setofdat].MarkDetailofUser;
var chartJSObj ={
"chartProperties":{
"chartHeight": 50,
"drawEntities":["axis","grid","columnChart"],
"columnChart":{
"columnId": [0],
/////// animations
"animations": {
"onInitAnimation": true
},
"graphType": "normal",
"dataAlignToAxis": ["primaryYAxis"],
"plotMissingValues": "assumeZero",
/////// bar config
"bar": {
"width": [400],
"fillType": ["color"],
"transparency": [0],
"gradientType": ["linearTopToBottom"],
"gradientRatios": [
[0, 20, 50, 100]
],
"color": ["0x169EECFF", "0xBE0056ff", "0xFCC40EFF", "0xff0000ff", "0x00ff00ff", "0x0000ffff"],
},
"border": {
"visible": false,
"line": {
"color": ["0xaaaaaaff"],
"width": [1],
"transparency": [0]
}
},
/////// chart datalabels
"dataLabels": {
"visible": true,
"indicators": ["numberValue"],
"separator": "space",
"placement": "inside",
"orientationAngle": 0,
"font": {
"size": [14],
"family": ["Verdana"],
"style": ["Bold"],
"color": ["0xaaaaaaff"],
"transparency": [0]
},
}
}
},
"chartData":{
"columnNames":{
"values":["col1"]
},
"rowNames":{
"values":["10th","12","UG"]
},
"data":{
"col1":setdata
}
}
};
return chartJSObj;
}
Create Timer on button click
function timerFunc(){
var da = new Date();
frmProfile.lblDatetimeshow.text = da.toLocaleTimeString();
}
var INtrue = false;
function itimerStart() //nested function
{
var d = new Date();
if(INtrue === false){
frmProfile.LblDateIn.text ="";
frmProfile.LblDateIn.text = d.toDateString();
frmProfile.lblStatusshow.text ="IN";
frmProfile.LblIntime.text ="IN:";
frmProfile.LblIntime.text = "IN:" + d.toLocaleTimeString();
frmProfile.LblOuttime.text ="OUT:";
INtrue = true;
frmProfile.imgProgressstatus.setVisibility(true);
}else if (INtrue === true) {
frmProfile.LblDateIn.text ="";
frmProfile.LblDateIn.text = d.toDateString();
frmProfile.LblOuttime.text ="OUT:";
frmProfile.LblOuttime.text = "OUT:" + d.toLocaleTimeString();
frmProfile.imgProgressstatus.setVisibility(false);
frmProfile.lblStatusshow.text ="OUT";
INtrue = false;
}
}
kony.timer.schedule("",timerFunc, 1, true);
var da = new Date();
frmProfile.lblDatetimeshow.text = da.toLocaleTimeString();
}
var INtrue = false;
function itimerStart() //nested function
{
var d = new Date();
if(INtrue === false){
frmProfile.LblDateIn.text ="";
frmProfile.LblDateIn.text = d.toDateString();
frmProfile.lblStatusshow.text ="IN";
frmProfile.LblIntime.text ="IN:";
frmProfile.LblIntime.text = "IN:" + d.toLocaleTimeString();
frmProfile.LblOuttime.text ="OUT:";
INtrue = true;
frmProfile.imgProgressstatus.setVisibility(true);
}else if (INtrue === true) {
frmProfile.LblDateIn.text ="";
frmProfile.LblDateIn.text = d.toDateString();
frmProfile.LblOuttime.text ="OUT:";
frmProfile.LblOuttime.text = "OUT:" + d.toLocaleTimeString();
frmProfile.imgProgressstatus.setVisibility(false);
frmProfile.lblStatusshow.text ="OUT";
INtrue = false;
}
}
kony.timer.schedule("",timerFunc, 1, true);
Flex Menu Creation form App
var Ibool = true;
function showsidebaritem(eventobject) {
function SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback() {}
if(Ibool === true){
kony.application.getCurrentForm().FlxMainMenu.animate(
kony.ui.createAnimation({
"100": {
"stepConfig": {
"timingFunction": kony.anim.EASE
},
"width": "40%",
"height": "100%"
}
}), {
"delay": 0,
"iterationCount": 1,
"fillMode": kony.anim.FILL_MODE_FORWARDS,
"duration": 0.25
}, {
"animationEnd": SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback
});
Ibool = false;
return false;
}
if(Ibool ===false){
kony.application.getCurrentForm().FlxMainMenu.animate(
kony.ui.createAnimation({
"100": {
"stepConfig": {
"timingFunction": kony.anim.EASE
},
"width": "0%",
"height": "0%"
}
}), {
"delay": 0,
"iterationCount": 1,
"fillMode": kony.anim.FILL_MODE_FORWARDS,
"duration": 0.25
}, {
"animationEnd": SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback
});
Ibool = true;
return false;
}
}
function showsidebaritem(eventobject) {
function SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback() {}
if(Ibool === true){
kony.application.getCurrentForm().FlxMainMenu.animate(
kony.ui.createAnimation({
"100": {
"stepConfig": {
"timingFunction": kony.anim.EASE
},
"width": "40%",
"height": "100%"
}
}), {
"delay": 0,
"iterationCount": 1,
"fillMode": kony.anim.FILL_MODE_FORWARDS,
"duration": 0.25
}, {
"animationEnd": SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback
});
Ibool = false;
return false;
}
if(Ibool ===false){
kony.application.getCurrentForm().FlxMainMenu.animate(
kony.ui.createAnimation({
"100": {
"stepConfig": {
"timingFunction": kony.anim.EASE
},
"width": "0%",
"height": "0%"
}
}), {
"delay": 0,
"iterationCount": 1,
"fillMode": kony.anim.FILL_MODE_FORWARDS,
"duration": 0.25
}, {
"animationEnd": SCALE_ACTION____e241c9bdb7514fbea4bcbd4a7b0e59a6_Callback
});
Ibool = true;
return false;
}
}
Create template header blog
frmRegistor.headers[0].lblHdrTag.text = "Registor";
Validation using regular expression in Javascript
Validation is an essential process in any mobile or web applications where we use forms. So I am sharing some ideas on how to do some basic validations ion Javascript using regular expressions. As this is for Javascript, there won't be much changes in other languages also.
Some regular expressions for basic validations.
"/\d/g" : For matching any digits if present in the string.
"/\s/g" : For matching any whitespace character if present in the string.
"/[a-zA-Z]/g" : For matching any letters if present in the string.
"/[0-9]/g" : For matching any numbers from 0-9 if present in the string.
"/[abc]/g" : will check for letters inside the square bracket if present throughout the string.
"/[a-b]/g" : will check for items between the range given inside square bracket if present throughout the string.
"/[a|b]/g" : will check for any of the items given inside square bracket if present throughout the string.
Test Method
We can use mainly Javascript test() method for pattern checking.
var pattern = new RegExp("[a-zA-Z]+");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
this will print true as letters are present inside the string str;
like this for checking digits present inside string, we can perform
var pattern = new RegExp("/\d/g"); OR var pattern = new RegExp("/[0-9]/g");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
for checking whitespace present inside string, we can perform
var pattern = new RegExp("/\s/g");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
Replace method
If we want to find a pattern in a string and change it with something else, we can use the Javascript replace() method.
If we want to remove all the whitespace characters from the string, we can perform it by
var pattern = new RegExp("/\s/g");
var str = "Hello World";
var res = str.replace(pattern, "");
This will remove all the whitespace characters with empty, like this we can remove any pattern found inside a string, or replace the pattern with some other patterns
Some regular expressions for basic validations.
"/\d/g" : For matching any digits if present in the string.
"/\s/g" : For matching any whitespace character if present in the string.
"/[a-zA-Z]/g" : For matching any letters if present in the string.
"/[0-9]/g" : For matching any numbers from 0-9 if present in the string.
"/[abc]/g" : will check for letters inside the square bracket if present throughout the string.
"/[a-b]/g" : will check for items between the range given inside square bracket if present throughout the string.
"/[a|b]/g" : will check for any of the items given inside square bracket if present throughout the string.
Test Method
We can use mainly Javascript test() method for pattern checking.
var pattern = new RegExp("[a-zA-Z]+");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
this will print true as letters are present inside the string str;
like this for checking digits present inside string, we can perform
var pattern = new RegExp("/\d/g"); OR var pattern = new RegExp("/[0-9]/g");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
for checking whitespace present inside string, we can perform
var pattern = new RegExp("/\s/g");
var str = "Hello World";
var res = pattern.test(str);
alert(res);
Replace method
If we want to find a pattern in a string and change it with something else, we can use the Javascript replace() method.
If we want to remove all the whitespace characters from the string, we can perform it by
var pattern = new RegExp("/\s/g");
var str = "Hello World";
var res = str.replace(pattern, "");
This will remove all the whitespace characters with empty, like this we can remove any pattern found inside a string, or replace the pattern with some other patterns
Subscribe to:
Posts (Atom)