Last active
February 15, 2017 08:24
-
-
Save sagarpanda/11192672 to your computer and use it in GitHub Desktop.
sencha touch tips
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # add extra coloum for fullname in sencha touch model | |
| Ext.define('Sencha.model.Employee', { | |
| extend: 'Ext.data.Model', | |
| config: { | |
| fields: [ | |
| {name: 'firstName', type: 'string'}, | |
| {name: 'lastName', type: 'string'}, | |
| { | |
| name: 'fullName', | |
| type: 'string', | |
| convert: function (value, record) { | |
| firstName = record.data.firstName; | |
| lastName = record.data.lastName; | |
| fullName = firstName + " " + lastName; | |
| return fullName; | |
| } | |
| } | |
| ] | |
| }, | |
| load: function () { | |
| console.log("Employee model"); | |
| this.callParent(arguments); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| abortRequest: function() { | |
| var req = this.getActiveRequest(); | |
| if (req) { | |
| delete req.options.success; | |
| delete req.options.failure; | |
| delete req.options.callback; | |
| Ext.Ajax.abort(req); | |
| } | |
| } | |
| ref: | |
| http://www.sencha.com/forum/showthread.php?232899 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # sencha touch cdn link | |
| http://cdn.sencha.com/touch/sencha-touch-2.3.1/resources/css/sencha-touch.css | |
| http://cdn.sencha.com/touch/sencha-touch-2.3.1/sencha-touch-all.js | |
| # create an instance of a class | |
| var instance = Ext.create('Ext.Panel'); | |
| var myInstance = Ext.create('MyApp.view.MyNote'); | |
| # get controller instance | |
| add controller in app.js like controllers: ['myXyzController'], then | |
| var controllerInstance = Trustomer.app.getController('myXyzController'); | |
| # get Store instance | |
| add `storeId` property while creating store class, ex: storeId: 'cmp_storeid_myXyzStore' | |
| var storeInstance = Ext.getStore('cmp_storeid_myXyzStore'); | |
| # clear store | |
| // get all records | |
| var range = Ext.getStore('cmp_storeid_myXyzStore').getRange(); | |
| // clear all records | |
| Ext.getStore('cmp_storeid_newsstore').remove(range); | |
| # Sencha Touch textareafield height solutions | |
| http://alvinalexander.com/javascript/sencha-touch-textareafield-height-fullscreen-solutions | |
| # Tap event in Panel and Container, example: | |
| listeners: [{ | |
| element: 'element', delegate : '.thumbnail', event: 'tap', | |
| fn: function(e){ console.log(e.getTarget().getAttribute('data-name')); } | |
| }] | |
| ref: http://www.sencha.com/forum/showthread.php?271855-add-listener-for-multiple-element-sencha-touch | |
| # Sencha list paging plugin | |
| ref: http://stackoverflow.com/questions/7321446/sencha-list-paging-plugin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment