sencha-touch-2

How to call functions within a XTemplate (itemTpl)

[亡魂溺海] 提交于 2019-11-29 11:58:30
问题 I would like to use Ext's String method on some text that will be output to the view. For example: itemTpl: [ ... '<tpl switch="post_type">', '<tpl case="new_user">', '<p>{post_text_teaser}</p>', '<p>{timestamp}</p>', '<tpl default>', '<p>' + Ext.String.ellipsis( + '{post_text_teaser}' + \, 4) + '</p>', ... ].join(''), but of course the concatenation in line 10 is illegal. Do you know if it's possible or how to do this correctly? 回答1: This should solve your problem: '<tpl switch="post_type">'

Drawing Html tables on a Panel?

假如想象 提交于 2019-11-29 10:19:42
问题 How can I generate a regular html <table> on a Panel in Sencha Touch 2? The data for each row could be from a store. It's not very "mobile" like a List, but I'd like to have a few detail Panels on my tablet app contain several sections like this: header #1 <table> <tr><td>one</td>td>two</td></tr> <tr><td>foo</td>td>bar</td></tr> </table> header #2 <table> <tr><td>abc</td>td>xyz</td></tr> <tr><td>cat</td>td>dog</td></tr> </table> The basic Panel definition should look something like this: Ext

Nested List, Multiple Layouts

我怕爱的太早我们不能终老 提交于 2019-11-29 08:20:47
In Sencha Touch 2.1, I have the following nested list defined: xtype: 'NestedList', docked: 'top', ui: 'light', store: treeStore, detailCard: true, detailContainer: // Reference to a Another Panel I can get the Nested List to appear, but adding items via JSON is proving problematic. Here's a sample of my JSON: [ { "BranchID" : 4, "BranchName" : "Branch Name", "Jobs" : [ { "JobOrderID" : 75, "JobTitle" : "Job Title", "leaf" : true } ] } ] And here is my Tree Store and List Item: // Define a List Item: Ext.define('Branch', { extend: 'Ext.data.Model', config: { fields: [ 'BranchID', 'BranchName'

Sencha Touch 2 - Android Performance

本小妞迷上赌 提交于 2019-11-29 07:11:26
We are developing a Sencha Touch 2 application which makes use of Phonegap to be able to install it as an application and access the storage of a device. This works really well on the iPad 2 and the iPad 3. However when we tried to run the application on an android device, the performance was very slow. The main elements which slowed down the system were lists and carousels. When we tried to test the same application through the chrome browser, the performance was on-par with that of the iPad. Do you have any suggestions on what we can do to improve the performance on android, maybe even

How to get Indian postal pincode using google map's lat & long? [closed]

大憨熊 提交于 2019-11-29 05:08:15
I am making an app which will take user's current location or his customized map marker to find out lat & long and then using those values I would like to know pincode(zipcode) of that area so that I can tell user whether goods can be delivered in that area or not. I have tried this : http://www.geonames.org/export/ws-overview.html but it doesn't have full data and whatever it has is not very accurate. Is there any other API which I can use to get such data? geocodezip If you have a location (and a Google Maps API v3 map), reverse geocode the location. Process through the returned records for

Call controller's function from another controller / Share data between controllers

好久不见. 提交于 2019-11-29 04:01:45
For the moment, when I'm in a controller and that I want to call a function from another controller, I do this : App.app.getControllerInstances()['App.controller.OtherController'].do_something(); Is seems a bit heavy to me, is there another (better) way to do this ? Thanks I would use the getController method: http://docs.sencha.com/touch/2-0/#!/api/Ext.app.Application-method-getController EG: this.getApplication().getController('ControllerName').doSomething(); If you're not in the context of your Controller(for example in a callback function of some object), you can do this. MyAppName.app

Display a list from nested json: Sencha Touch 2

匆匆过客 提交于 2019-11-29 00:16:53
I have a list that displays a list of restaurants with the logo of the restaurant etc. The view Ext.define('Test.view.Contacts', { extend: 'Ext.List', xtype: 'contacts', config: { title: 'Stores', cls: 'x-contacts', store: 'Contacts', itemTpl: [ '<div class="headshot" style="background-image:url(resources/images/logos/{logo});"></div>', '{name}', '<span>{add1}</span>' ].join('') } }); When you tap the restaurant i want it to show another list based on the item tapped. The second view Ext.define('Test.view.Menu', { extend: 'Ext.List', xtype: 'contact-menu', config: { title: 'Menu', cls: 'x

Adding a click event to an element?

血红的双手。 提交于 2019-11-28 21:35:56
问题 How can one assign a click event to an arbitrary span ( eg. <span id="foo">foo</span> ) in an ST2 app? I have a trivial example that illustrates the idea of what I'd like to do. In the example, I write the letters A,B,C and I'd like to tell the user which letter they clicked. Here's an image: CODE SNIPPET Ext.application({ launch: function() { var view = Ext.create('Ext.Container', { layout: { type: 'vbox' }, items: [{ html: '<span id="let_a">A</span> <span id="let_b">B</span> <span style=

how to handle device back button on sencha touch application

三世轮回 提交于 2019-11-28 19:22:48
问题 In Sencha touch if I use navigation view i can get back button. This is pretty fine. But what if user hit device backbutton? it is direct exiting the applicaiton. In my requirement it should not exit the application it has to go back to previous screen.How can i do this?. 回答1: You can handle hardware back button like this: if (Ext.os.is('Android')) { document.addEventListener("backbutton", Ext.bind(onBackKeyDown, this), false); function onBackKeyDown(eve) { eve.preventDefault(); //do

How to get value form record in sencha touch

只愿长相守 提交于 2019-11-28 12:38:53
I am trying to get value from nested json, but unable to get value. I have following data structure. Here I am printing record. What i did. onWordTap: function(view, index, target, record, event) { var wordName=record.get('name'); console.log("Word--->>>>"+wordName); console.log(record); }, but i get in console like this:-> Word--->>>>undefined I have tried this also: var wordName=record.data.get('name'); but getting Uncaught TypeError: Object # has no method 'get' my JSON looks like this: JSON My previous question is also related to this type question, please watch . Previous Problem I am