0

Questions

1) I am using reloadview function to reload my commentview after a new comment entry. How do i set the parameters for the values in the cell in the grid i created using cellCreator and cellUpdater?

CODE
			KONtx.application.reloadView({						
movieID: this.getView().controls.movieID.data,

title: this.getView().controls.title.data,

description: this.getView().controls.description.data,

director: this.getView().controls.director.data,

cast: this.getView().controls.cast.data,

language: this.getView().controls.language.data,

openingtime: this.getView().controls.openingtime.data,

image: this.getView().controls.image.src,

videoURL: this.getView().controls.videoURL.data,
ratings: this.getView().controls.ratings.data,
//grid values needs to be updated too
},(true));


2) This is a part of my codes where I will get the boolean value to verify the username and password to proceed to login. It is actually working but it requires me to enter twice in order to proceed (the first enter will stay in the loginView and the second enter will go to the next page). May i ask what is the reason that causes this to happen and what is the solution to solve this problem?

CODE
var DetailView = new KONtx.Class({

ClassName: 'DetailView',



Extends: KONtx.system.FullscreenView,

config: {






Username_XML: false,

Username_items: [],
Password_XML: false,

Password_items: [],

},

createView: function() {




var login_header = new KONtx.control.Header({

label: 'Login',

styles: {
vOffset: 363,
hOffset: 666,
width: 294,

}

}).appendTo(this);


var usernameButton = new KONtx.control.TextEntryButton({

guid: 'Username',

label: 'Username',

styles: {
backgroundColor: '#181818',

vOffset: 387,

hOffset: 666

},

events: {

onSubmit: function(event) {

log($dump(event));

log($dump(event.payload));

log(event.payload.value);

this.getView().controls.usernameLogin.data = event.payload.value;

}

}

}).appendTo(this);

var passwordButton = new KONtx.control.TextEntryButton({

guid: 'Password',

label: 'Password',

secureMask: true,

secureMaskType: 'mask-all',

styles: {
backgroundColor: '#181818',

hOffset: 666,

vOffset: usernameButton.outerHeight



},

events: {

onSubmit: function(event) {

log($dump(event));

log($dump(event.payload));

log(event.payload.value);

this.getView().controls.passwordLogin.data = event.payload.value;
}}

}).appendTo(this);




this.controls.usernameLogin = new KONtx.element.Text({



})
this.controls.passwordLogin = new KONtx.element.Text({



})
this.controls.usernameBoolean = new KONtx.element.Text({



})
this.controls.passwordBoolean = new KONtx.element.Text({



})



this.controls.button2 = new KONtx.control.TextButton({

label: 'Login and Post Comments',



styles: {
backgroundColor: '#181818',

width: 294,

height: 25,

textAlign: "left",

vOffset: passwordButton.outerHeight,

hOffset: 666

}, //Style information for the Button stored in our 960x540.js file

events: {

//Setup a onSelect Event to handle the button action

onSelect:function(event){




var usernameUrl='http://123.45.67.89/MoviesWS/Service.asmx/checkUsername?username='+this.getView().controls.usernameLogin.data;
var passwordUrl='http://123.45.67.89/MoviesWS/Service.asmx/checkPassword?username='+this.getView().controls.usernameLogin.data+'&password='+this.getView().controls.passwordLogin.data;
var inLoginStatus = {

username: this.getView().controls.usernameLogin.data,

status: "True"

};

currentAppData.set("loginStatus", JSON.stringify(inLoginStatus));
this.getView().grabUsernameXML(usernameUrl);
this.getView().grabPasswordXML(passwordUrl);
this.getView().getUsername();
this.getView().getPassword();

if (this.getView().controls.usernameBoolean.data=="true" && this.getView().controls.passwordBoolean.data=="true"){

KONtx.application.loadView('view-Login', {



});}
else if(this.getView().controls.usernameBoolean.data=="false"){

var dialog = new KONtx.dialogs.Alert({

title: "Wrong username",

message: "Username entered is wrong.",

buttons: [{

label: "Ok",

callback: function(){

log("User said everything is a-ok!");

}

}],

cancelCallback: function() {

log("Dialog was canceled by the user by hitting the back button");

}

});

dialog.show();

}
else if(this.getView().controls.passwordBoolean.data=="false"){

var dialog = new KONtx.dialogs.Alert({

title: "Wrong password",

message: "Password entered is wrong.",

buttons: [{

label: "Ok",

callback: function(){

log("User said everything is a-ok!");

}

}],

cancelCallback: function() {

log("Dialog was canceled by the user by hitting the back button");

}

});

dialog.show();
}

//}

},

}

}).appendTo(this);


},


updateView: function() {




},




getUsername:function(){





//Let's create a new object

var getUsernameVar = this.config.Username_XML.evaluate('string(boolean)')



this.controls.usernameBoolean.setText(getUsernameVar);



},
getPassword:function(){





//Let's create a new object

var getPasswordVar = this.config.Password_XML.evaluate('string(boolean)')



this.controls.passwordBoolean.setText(getPasswordVar);



},




grabUsernameXML: function(url){

//We are activating the Loading Indicator for the widgets so that we can alert the user to the fact we are loading data.

KONtx.utility.LoadingOverlay.on();

//Again we need a reference to the view while we seto out into the Network Object

var self = this;

//We are send a Network Request

Network.send(url,self.finishUsernameXML,{view:self, mess:'Feed Loaded '});

//NOTE: We are passing the reference to this view through the object in the Third Value slot

},



finishUsernameXML: function(response,extra){

//ALWAYS wrap your parse statements in a try{}catch(e){} statement -> ALWAYS

try{

print('Parsing the XML Feed\n'+response+'\n'); //We will be showing the Response Data in the terminal

extra.view.config.Username_XML = XMLDOM.parse( response ); //If we get a valid reponse back we need to parse out the XML

}

catch(e)

{

print('DANGER: We could not parse the XML Feed');

extra.view.config.Username_XML= false; //This kills the updateView check below

}



//We are kill the Loading Indicator for the widgets so that we can alert the user to the fact we are done loading data.

KONtx.utility.LoadingOverlay.off();



//Now we only want to update the Feed if we have a valid XML object

if(extra.view.config.Username_XML) //Check to make sure we were able to parse the XML feed

{

print(extra.mess); //This information comes from the third item in the Network.send() and is passed back in the second value of this.finishXML()

extra.view.updateView(); //Now let's update the View with the new information

}

else //If the Feed fails to Load, show an error dialog

{

extra.view._showErrorDialog();

}

},
grabPasswordXML: function(url){

//We are activating the Loading Indicator for the widgets so that we can alert the user to the fact we are loading data.

KONtx.utility.LoadingOverlay.on();

//Again we need a reference to the view while we seto out into the Network Object

var self = this;

//We are send a Network Request

Network.send(url,self.finishPasswordXML,{view:self, mess:'Feed Loaded '});

//NOTE: We are passing the reference to this view through the object in the Third Value slot

},



finishPasswordXML: function(response,extra){

//ALWAYS wrap your parse statements in a try{}catch(e){} statement -> ALWAYS

try{

print('Parsing the XML Feed\n'+response+'\n'); //We will be showing the Response Data in the terminal

extra.view.config.Password_XML = XMLDOM.parse( response ); //If we get a valid reponse back we need to parse out the XML

}

catch(e)

{

print('DANGER: We could not parse the XML Feed');

extra.view.config.Password_XML = false; //This kills the updateView check below

}



//We are kill the Loading Indicator for the widgets so that we can alert the user to the fact we are done loading data.

KONtx.utility.LoadingOverlay.off();



//Now we only want to update the Feed if we have a valid XML object

if(extra.view.config.Password_XML) //Check to make sure we were able to parse the XML feed

{

print(extra.mess); //This information comes from the third item in the Network.send() and is passed back in the second value of this.finishXML()

extra.view.updateView(); //Now let's update the View with the new information

}

else //If the Feed fails to Load, show an error dialog

{

extra.view._showErrorDialog();

}

},



_showErrorDialog: function() {

//Setup an interval View Reference

var self = this;

//Create the Error Dialog

this._errorDialog = new KONtx.dialogs.Alert({

title: 'Could Not Load XML Feed',

message: 'We are sorry the XML Feed requested could not be loaded.',

buttons: [

{ label: 'OK', callback: function() {

self._errorDialog.hide(); //Hide the Error Dialog after the User confirms the loading error

} }

]

});

this._errorDialog.show(); //Show the Error Dialog

},





});


3) I have problems playing videos even from the mediaplayer sample given. The screenshot below shows the error shown in the terminal when i try to play a video.

by
1 Reply
  • I solve my first problem. I am still stuck with the 2nd and 3rd. Urgently needing help. Thanks.
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets