Author Archive

Placing Video in Sencha Touch

var panel = new Ext.Panel({
    fullscreen: true,
    items: [
        {
            xtype    : 'video',
            x        : 500,
            y        : 250,
            width    : 125,
            height   : 120,
            url      : "exmaple.mov",
            posterUrl: 'example.png'
        }
    ]
});

Transitions in Sencha – Examples

var App = new Ext.Application({

name: ‘TestApp’,

useLoadMask: true,

launch: function () {

Ext.regModel(‘Contact’, {

fields: ['animation', 'extra']

});

var store = new Ext.data.JsonStore({

model : ‘Contact’,

data: [

{animation: 'Slide',        extra: ''},

{animation: 'Slide',         extra: 'Cover'},

{animation: 'Slide',         extra: 'Reveal'},

{animation: 'Pop',         extra: ''},

{animation: 'Flip',         extra: ''},

{animation: 'Cube',         extra: ''},

{animation: 'Fade',         extra: ''}

]

});

var list = new Ext.List({

fullscreen: true,

itemTpl : ‘{animation} {extra}’,

listeners:{

itemtap: function( dv, index, item, e){

if ( index == 0 ) //Slide

{

TestApp.views.viewport.setActiveItem(1, { type: ‘slide’, direction: ‘left’ });

}

else if ( index == 1 ) //Slide Cover

{

TestApp.views.viewport.setActiveItem(1, { type: ‘slide’, cover: true });

}

else if ( index == 2 ) //Slide Reveal

{

TestApp.views.viewport.setActiveItem(1, { type: ‘slide’, reveal: true });

}

else if ( index == 3 ) //Pop

{

TestApp.views.viewport.setActiveItem(1, { type: ‘pop’, duration: 1000 });

}

else if ( index == 4 ) //Flip

{

TestApp.views.viewport.setActiveItem(1, { type: ‘flip’, duration: 600 });

}

else if ( index == 5 ) //Cube

{

TestApp.views.viewport.setActiveItem(1, { type: ‘cube’, duration: 600 });

}

else if ( index == 6 ) //Fade

{

TestApp.views.viewport.setActiveItem(1, { type: ‘fade’, duration: 1600 });

}

}

},

indexBar: true,

store: store

});

list.show();

TestApp.views.topToolbar = new Ext.Toolbar({

title: ‘Animation Example’,

items: [

{

text: 'Back',

ui: 'back',

handler: function ()

{

TestApp.views.viewport.setActiveItem(0, { type: 'slide', direction: 'right' });

}

}]

});

TestApp.views.viewport = new Ext.Panel({

fullscreen: true,

layout : ‘card’,

cardAnimation : ‘slide’,

items: [

list,

{

xtype: 'panel',

html:'Test Panel to demonstrate different Transitions.',

dockedItems: TestApp.views.topToolbar

}

]

});

}

});

Form Elements in Sencha

var App = new Ext.Application({

name: ‘TestApp’,

useLoadMask: true,

launch: function () {

new Ext.form.FormPanel({

fullscreen: true,

title : ‘Testing Form Fields’,

items: [

{

xtype : 'sliderfield',

label : 'Volume',

value : 5,

minValue: 0,

maxValue: 10

},{

xtype : 'checkboxfield',

label        : 'Checkbox',

checked        : 'yes'

},{

xtype : 'togglefield',

label        : 'Toggle'

},{

xtype : 'datepickerfield',

label        : 'Date Picker Field'

},{

xtype : 'emailfield',

label        : 'Email Field'

},{

xtype : 'spinnerfield',

label        : 'Spinner Field'

},{

xtype : 'textfield',

label        : 'Text Field'

},{

xtype : 'textareafield',

label        : 'Text Area Field'

}],

});

}

});

Simple Data Store Application in Sencha

var App = new Ext.Application({

name: ‘TestApp’,

useLoadMask: true,

launch: function () {

Ext.regModel(‘Contact’, {

fields: ['firstName', 'lastName']

});

var store = new Ext.data.JsonStore({

model : ‘Contact’,

data: [

{firstName: 'Tommy', lastName: 'Maintz'},

{firstName: 'Rob', lastName: 'Dougan'},

{firstName: 'Ed', lastName: 'Spencer'},

{firstName: 'Jamie', lastName: 'Avins'},

{firstName: 'Aaron', lastName: 'Conran'},

{firstName: 'Dave', lastName: 'Kaneda'},

{firstName: 'Michael', lastName: 'Mullany'},

{firstName: 'Abraham', lastName: 'Elias'},

{firstName: 'Jay', lastName: 'Robinson'}

]

});

var list = new Ext.List({

fullscreen: true,

itemTpl : ‘{firstName} {lastName}’,

indexBar: true,

store: store

});

list.show();

}

});

Adding Map in Sencha Touch

var panel = new Ext.Panel({
    fullscreen: true,
    items: [{
        xtype: 'map',
        useCurrentLocation: true
    }]
});

source: sencha.com

Incoming search terms:

  • add google map to panel in sencha

Prevent Zooming in sencha touch

preventZooming// true or false 

Browser Specific Code in Sencha Touch

if (Ext.browser.is.IE) {
     // IE specific code here
}

if (Ext.browser.is.WebKit) {
     // WebKit specific code here
}

console.log("Version " + Ext.browser.version);

ser: sencha.com

Hiding Address bar in Sencha Touch

when you browse your sencha site. you can experience a problem that the address bar is showing which will hide your tab bar at the bottom (particularly in Android).

Use the following code to fix the problem.

if(Ext.is.Android) 
{
   	 window.scrollTo(0,1);
}

MySQL Tables – locking a row.

Row Locking in MySQL can be performed in two ways.

 
 

1) SELECT … FOR UPDATE

Any lock placed with the FOR UPDATE will not allow other transactions to read, update or delete the row. Other transaction can read this rows only once first transaction get

commit or rollback.

Example:

SELECT * FROM tblTest WHERE id=100 FOR UPDATE;

 

2) LOCK IN SHARE MODE

Any lock placed with LOCK IN SHARE MODE will allow other transaction to read the locked row but it will not allow other transaction to update or delete the row. Other transaction can update or delete the row once the first transaction gets commit or rollback.

Example:

SELECT * FROM tblTest WHERE id=100 LOCK IN SHARE MODE;

 

Here once the first transaction commit or rollback then second transaction which is waiting for first transaction to finish will get an updates row rather than the old one.

 
 

This way we can serve the fresh data to the user and can handle the concurrent request in better way.

Get the starting point of a touch

To get the start position of a touch, use the following

event.xStart
event.yStart
Page 4 of 42« First...23456...102030...Last »
We Can Build Your App for You. Lets Get Started !