Archive for October, 2011

Sencha Touch: Scroll To Top After Leaving a Panel

Monday, October 17th, 2011

This doesn’t seem to work on Ext.List, but you can add a List with “scroll:false” as a child of an Ext.Panel with “scroll:true” and add this listener to the Ext.Panel.  Now the next time the user goes back to that panel, they are at the top of the list, form, content, etc.

listeners          : {
  hide : function() {
    this.scroller.scrollTo({ x: 0, y: 0 })
  }
}

Sencha Touch Deselect List Item After Item Tap

Monday, October 17th, 2011

All you need to do is add this wonderful little listener and a timeout. If anyone knows how do do this globally as an override to the List type, I’m all ears.

listeners: {
  itemtap: function(record, index, item, e) {
    setTimeout(function(){record.deselect(index);},500);
  }
}

Sencha Touch Email to User

Thursday, October 13th, 2011

There are really only two approaches.  One is to send a notice to your server to send a particular user an email.  For lightweight requirements, you can just do this:

var msg = {
subject : "My genius email",
body : "Something about rabid squirrels in your coffee... nothing wakes you up, like rabies in your cup"
};
window.location = "mailto:" + MyApp.User.Email + "?" + Ext.urlEncode(msg);

Do not make this simple iPhone mailto link mistake

Thursday, October 13th, 2011

IS: mailto:myemail@gmail.com?subject=wearmorepantsjames&body=someurlencodedtext

NOT: mailto:myemail@gmail.com&subject=wearmorepantsjames&body=someurlencodedtext

The iOS web package is not smart enough to translate that ampersand into a question mark like your desktop setup is.

Modify a Sencha Touch Ext.Msg.Prompt with Custom Buttons

Tuesday, October 11th, 2011

I’ll just skip to showing you the code… basically, just create your own message box instead of using the default prompt.  You create your own buttons and set custom text to whatever you like.

Ext.Msg.show({
  title   : 'Enter Email Address',
  msg     : null,
  buttons : [{
    itemId : 'ok',
    text   : 'Send',
    ui     : 'action'
  },{
    itemId : 'cancel',
    text   : 'Cancel'
  }],
  prompt  : { maxlength : 180, autocapitalize : false },
  fn      : function(text,btn) {
    // do some stuff
  }
});

©2005-2018 Blog – Epiphany Digital is proudly powered by Badgers and Web Design is by Epiphany Digital
Entries (RSS) and Comments (RSS). 24 queries. 2.072 seconds.

Thank you for visiting this site. The web fairy will visit you in your sleep... you know, I was going somewhere with this, but it really doesn't have as much innocent charm as the tooth fairy, especially when I picture the web fairy as someone much like the Simpsons' Comic Book Guy but with wings. It's just not something I want.