PDA

View Full Version : Basic login tutorial extended with DWR



vladimirus
7 Apr 2008, 10:43 AM
Hi,

I am new to ext.js but it looks very cool but also quite complicated. Is it possible for anyone to add DWR to the Basic Login tutorial:

http://extjs.com/learn/Tutorial:Basic_Login

so i can clearly see how ext interacts with DWR (I know, i read the forum... I read about creating data sources etc, still... i am not very clear about it)...

Say I have DWR js: MemberManager.login(username, password) what do i have to do to make it work in the Basic Login tutorial?

Many thanks in advance,

vladimirus

vladimirus
13 Apr 2008, 2:34 PM
Is the code below the correct (normal or accepted) way of communicating with DWR: (it works fine, I am just curious if I am doing anything wrong)



// All the magic happens after the user clicks the button
buttons : [{
text : 'Login',
formBind : true,
handler : function() {
Ext.MessageBox.show({
title: 'Sending data',
width: 240,
closable: false,
progressText: 'Sending...',
wait:true,
waitConfig: {interval:100}
});
var d = login.form.getValues(true);
MemberManager.login(d, function(stringData){
Ext.MessageBox.hide();
try {
var jsonData = Ext.util.JSON.decode(stringData);
if(jsonData.success == 'true'){
location.reload();
}else{
Ext.MessageBox.alert('Error', jsonData.errors.reason);
}
}catch (err){
Ext.MessageBox.alert('Error', 'Authentication server is unreachable');
}
});
}
}]