我有两个观点.用户视图有一些文本和一个按钮.我想使用该按钮切换到第二个视图.但我不知道如何使用sencha touch 2.当我按下"UserView"(这是第一个视图)上的按钮时,我收到以下错误:
未捕获错误:SYNTAX_ERR:DOM异常12
这基本上就是我的代码现在的样子:
app.js
Ext.Loader.setConfig({ enabled: true });
Ext.setup({
viewport: {
autoMaximize: false
},
onReady: function() {
var app = new Ext.Application({
name: 'AM',
controllers: [
'Main'
]
});
}
});
Run Code Online (Sandbox Code Playgroud)
主控制器
Ext.define('AM.controller.Main', {
extend: 'Ext.app.Controller',
views : ['User'],
init: function() {
this.getUserView().create();
this.control ({
'#new': {
tap: function() {
alert('aaaa');
}
}
});
}
});
Run Code Online (Sandbox Code Playgroud)
这两个观点:
Ext.define('AM.view.User', {
extend: 'Ext.Container',
config: {
fullscreen:true,
items: [{
xtype: 'button',
text: 'New',
id: 'new'
}
],
html: 'Testing<br />'
} …
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我试图改变标题的颜色.为此,我在app.scss文件中添加了一些主题.我可以更改标题栏的背景颜色.但标题的颜色并没有改变.我的app.scss文件是这样的:
$base-color: #588aad; // go big blue!$include_default_icons: false;
@import 'sencha-touch/default/all';
@include sencha-panel;
@include sencha-buttons;
@include sencha-sheet;
@include sencha-picker;
@include sencha-tabs;
@include sencha-toolbar;
@include sencha-toolbar-forms;
@include sencha-indexbar;
@include sencha-list;
@include sencha-layout;
@include sencha-form;
@include sencha-msgbox;
@include sencha-loading-spinner;
@include pictos-iconmask("bookmarks");
@include pictos-iconmask("compose");
@include pictos-iconmask("trash");
@include pictos-iconmask("search");
@include pictos-iconmask("bookmark2");
@include sencha-toolbar-ui('blue', #EEEEEE,'matte');
.x-toolbar .x-toolbar-title {
color: #5a3d23;
}
Run Code Online (Sandbox Code Playgroud)
这是我的面板代码:
Ext.define('MyApp.view.TitlePanel', {
extend: 'Ext.Panel',
config: {
modal: false,
items: [
{
xtype: 'titlebar',
docked: 'top',
height: 120,
ui: 'blue',
title: 'Teritree Bussiness Portal',
items: …
Run Code Online (Sandbox Code Playgroud) 我有一个需要使用POST而不是GET调用的服务.我以为我在某处读到了我可以简单地添加方法:代理上的'POST'选项,但它似乎没有效果.
Ext.define('Sencha.store.Teams', { extend: 'Ext.data.Store', config: { model: 'Sencha.model.Team', autoLoad: true, proxy: { type: 'ajax', // method: 'GET', method: 'POST', url: 'teams.json' } } });
如何在sencha中动态更改文本字段的颜色?我尝试过以下提到的方法:
Ext.getCmp('fieldId').setStyle('color:red;');
Ext.getCmp('fieldId')setFieldStyle('color:red');
Ext.getCmp('fieldId').setCls('updateColor');
Ext.getCmp('fieldId').addCls('updateColor');
Ext.getCmp('fieldId').btnInnerEl.setStyle({color:"red"});
Run Code Online (Sandbox Code Playgroud)
css文件:
.updateColor{
color: red;
}
Run Code Online (Sandbox Code Playgroud)
以上都不是.我们如何动态更改文本字段颜色?
我正在开发一个带phonegap + sencha touch2 + android的应用程序.我有一个面板显示包含电子邮件的各种内容,一些文本形式的数字.因为它是一个WebView,当我点击数字,并且默认的MailCompose活动开始,当我点击数字拨号器活动开始.如何禁止这种情况发生.在为WebView加载url或web设置之前,是否有一些我在android端缺少的配置.或者来自Phonegap的东西,因为当我看到log cat它显示以下行 -
DroidGap.startActivityForResult(intent,-1)
android-intent android-webview android-websettings sencha-touch-2 cordova
我正在使用Sencha Touch 2,0,1.
我需要从Controller中的View中获取一个元素.
目前我使用此方法正确获取View,但我无法在View中获取Item.我没有得到任何错误,只是测试未定义.
有任何想法吗?
在控制器中:
var test = this.getDetailView().items['editButton'];
Run Code Online (Sandbox Code Playgroud)
视图中的代码:
Ext.define('XXX.view.DetailView',{
...
items: [
{
xtype: 'button',
text: 'Edit XXX',
ui: 'custom-btn-dwn-timetable',
itemId: 'editButton'
}
],
...
}
Run Code Online (Sandbox Code Playgroud) 您好,我有一个使用代理填充商店的应用程序。我想通过单击按钮清除商店,并让用户输入不同的信息并重新填充(如果有意义)。我目前正在使用:
window.location.reload();
Run Code Online (Sandbox Code Playgroud)
但这会导致白屏几秒钟,这不太好。我还尝试过以下操作:
var store = Ext.getStore('Places');
store.getProxy().clear();
store.data.clear(); store.sync();
Run Code Online (Sandbox Code Playgroud)
但这给出了与 .getProxy() 有关的错误
我也尝试过:
Ext.StoreMgr.get('Places').removeAll();
Ext.StoreMgr.get('Places').sync();
Run Code Online (Sandbox Code Playgroud)
但是当我去重新填充旧数据时仍然存在。有没有办法清理商店?
我有一个列表链接到一个充满Facebook好友的商店.它包含大约350条记录.列表顶部有一个搜索字段,用于触发keyup上的以下功能:
filterList: function (value) {
// console.time(value);
if (value === null) return;
var searchRegExp = new RegExp(value, 'g' + 'i'),
all = Ext.getStore('Friends'),
recent = Ext.getStore('Recent'),
myFilter;
all.clearFilter();
recent.clearFilter();
// console.log(value, searchRegExp);
myFilter = function (record) {
return searchRegExp.test(record.get('name'));
}
all.filter(myFilter);
recent.filter(myFilter);
// console.timeEnd(value);
},
Run Code Online (Sandbox Code Playgroud)
现在,这曾经与ST2.1.1一起使用,但是我将应用程序升级到ST2.2.这真的很慢.它甚至使得Safari在iOS上冻结和崩溃......
这是日志给出的:
t /t/gi Friends.js:147
t: 457ms Friends.js:155
ti /ti/gi Friends.js:147
ti: 6329ms Friends.js:155
tit /tit/gi Friends.js:147
tit: 7389ms Friends.js:155
tito /tito/gi Friends.js:147
tito: 7137ms
Run Code Online (Sandbox Code Playgroud)
有谁知道它为什么现在这样,或者有没有人有更好的过滤方法.
更新
clearFilter
用一个true
参数调用似乎可以加快速度,但它并不像以前那么快.
更新
它实际上与过滤商店无关.
它与渲染列表项有关.Sencha显然为我在商店中的每条记录创建了一个列表项,而不是仅创建几个列表项并重用它们
它有这么明显的原因吗?
我想在列表项目上添加按钮.列表项包含来自商店的相同数据.我想在每个列表项上添加提交按钮.我尝试过使用Html按钮,但如果单击按钮,则会调用tap事件和按钮选项卡事件.在sencha中有没有办法解决这个问题.谢谢
我正在尝试使用以下内容生成新应用:
root@li184-76:/var/www/touch-2.3.1# sencha generate app NewApp ../newapp
Run Code Online (Sandbox Code Playgroud)
但是,我得到以下内容:
Sencha Cmd v4.0.1.4
[INF] Workspace does not have framework touch at /var/www ... copying
[ERR] java.lang.NullPointerException
at com.sencha.util.Version.<init>(Version.java:36)
at com.sencha.command.generator.GeneratorCommands$WorkspaceCommand.getParameters(GeneratorCommands.java:130)
at com.sencha.command.BasePluginCommands$BasePluginCommand.doExecute(BasePluginCommands.java:23)
at com.sencha.command.generator.GeneratorCommands$WorkspaceCommand.execute(GeneratorCommands.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.cli.AbstractCommand.dispatch(AbstractCommand.java:124)
at com.sencha.command.generator.GeneratorCommands$AppCommand.generateWorkspace(GeneratorCommands.java:397)
at com.sencha.command.generator.GeneratorCommands$AppCommand.execute(GeneratorCommands.java:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at com.sencha.util.MethodInvoker$Arguments.invoke(MethodInvoker.java:175)
at com.sencha.cli.Command.dispatch(Command.java:42)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.cli.Commands.dispatch(Commands.java:64)
at com.sencha.command.Sencha.dispatch(Sencha.java:80)
at com.sencha.command.Sencha.main(Sencha.java:148)
Run Code Online (Sandbox Code Playgroud)
令人困惑的是我之前已经生成了应用程序.我不知道为什么我创造新的尝试失败了.
注意:
我尝试升级Sencha但它似乎确实具有欲望效果,如下所示:
root@li184-76:/var/www/touch-2.3.1# sencha upgrade …
Run Code Online (Sandbox Code Playgroud) 我有一个视图,其中包含几个项目(标签,旋转木马,容器等) -
Ext.define('MyApp.view.MyView', {
extend:'Ext.Panel',
alias:'widget.view',
requires:['Ext.Panel', 'Ext.carousel.Carousel'],
config:{
layout:'vbox',
cls: 'detail',
scrollable:{
direction:'vertical'
}
},
initialize:function () {
var type = {
xtype: 'label',
id:'type',
html:'Type'
};
var socialButton = {
xtype:'label',
id:'socialButton',
html:'<div style="position: absolute; right: 0; top: 0px; background: #efefef; border: 1px solid #e5e5e5">' +
'<div class="x-button social-button" btnType="fb_icon" style="background: #fff url(resources/images/appimages/facebook.png) no-repeat;"></div>' +
'<div class="x-button social-button" btnType="twitter_icon" style="background: #fff url(resources/images/appimages/twitter.png) no-repeat;"></div>' +
'<div class="x-button social-button" btnType="google_icon" style="background: #fff url(resources/images/appimages/google.png) no-repeat;"></div>' +
'<div class="x-button social-button" btnType="linked_icon" style="background: …
Run Code Online (Sandbox Code Playgroud) 可能重复:
Sencha Touch JSON格式
我有以下JSON文件,我想解析我的Sencha Touch应用程序.我无法弄清楚要使用什么类型的"商店"(Store,JsonStore,ArrayStore等)以及"字段"设置会是什么样的.数组中的每个"数据点"应存储为xValue和yValue.我不明白如果没有单独的标签,这些点是如何读取的......
[{"target": "stats.server1", "datapoints": [[22, 34], [99, 12], [13, 15], [56, 12], [34, 2], [13, 23], [23, 34], [55, 88]]},{"target": "stats.server2", "datapoints": [[22, 34], [99, 12], [13, 15], [56, 12], [34, 2], [13, 23], [23, 34], [55, 88]]}]
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激!
sencha-touch-2 ×12
sencha-touch ×8
extjs ×3
javascript ×3
cordova ×1
css ×1
css3 ×1
json ×1
linux ×1
themes ×1