小编kmc*_*kmc的帖子

Sencha Touch 2嵌套模型和数据存储

我几乎不知道怎么问这个,但是这里有.

我有两个模型,一个包含许多食谱的拼盘:

Ext.define('NC.model.Platter', {
  extend: 'Ext.data.Model',
  config: {
    fields: [
      { name: 'name', type: 'string' },
      { name: 'text', type: 'string' }
    ],
    associations: [
      {type: 'hasMany', model: 'NC.model.Recipe', name: 'recipes', filterProperty: 'text'}
    ]
  }
});

Ext.define('NC.model.Recipe', {
  extend: 'Ext.data.Model',
  config: {
      fields: [
        { name: 'name', type: 'string' },
        { name: 'image', type: 'string' },
        { name: 'stepsText', type: 'string', mapping: 'properties.preparationText' },
        { name: 'ingredientsText', type: 'string', mapping: 'properties.ingredientsText' }
      ]
    }
});
Run Code Online (Sandbox Code Playgroud)

Platters基本上是在线食谱商店的不同过滤器.所以我可能有一千个食谱,但我的'Pizza'拼盘只会返回披萨配方(因此filterProperty).Platters只是在本地创建和存储,而Recipes是在线的.所以,商店:

Ext.define('NC.store.Platters', {
  extend: 'Ext.data.Store', …
Run Code Online (Sandbox Code Playgroud)

extjs sencha-touch sencha-touch-2

10
推荐指数
1
解决办法
4643
查看次数

HTML5应用程序清单未清除清单更改上的缓存

我有一个rails应用程序,我试图使用Rack :: Offline使用HTML5应用程序缓存.application.manifest文件已设置,正在由我的HTML页面下载和检查.清单如下:

CACHE MANIFEST
# 2d9bf2b03a07dc960fd8fe69659ceeffd4d28ccf8619669a506c3682bf223878
404.html
422.html
500.html
login.html
stylesheets/scaffold.css
javascripts/jquery.min.js
javascripts/jquery.js
javascripts/application.js
javascripts/rmbz.js
javascripts/rails.js
images/rails.png

NETWORK:
/
Run Code Online (Sandbox Code Playgroud)

我正在访问的页面是localhost:3000/mobile,它已经缓存得很好(当我取下rails服务器时可以查看).但是,它引用的application.manifest文件已更改(实际上它通过操作注释的十六进制ID随每个请求而更改),但Chrome不更新页面.Chrome中的控制台日志提供以下内容:

Document was loaded from Application Cache with manifest http://localhost:3000/application.manifest
Application Cache Checking event
Application Cache Downloading event
Application Cache Progress event (0 of 12) http://localhost:3000/login.html
Application Cache Progress event (1 of 12) http://localhost:3000/404.html
Application Cache Progress event (2 of 12) http://localhost:3000/422.html
Application Cache Progress event (3 of 12) http://localhost:3000/javascripts/rails.js
Application Cache Progress event (4 of 12) http://localhost:3000/javascripts/rmbz.js
Application Cache …
Run Code Online (Sandbox Code Playgroud)

html5 caching offline ruby-on-rails

6
推荐指数
1
解决办法
3971
查看次数

在Sencha Touch 2中制作动画尺寸

我正在尝试为数据视图的高度设置动画,但它目前只是在视口周围滑动面板而不是将其保持在原位并改变它的高度.代码如下:

Ext.Anim.run(el, 'slide', {
  from: { height: height },
  to: { height: newHeight },
  out: false,
  direction: 'up',
  easing: 'ease-out',
  duration: 1000
});
Run Code Online (Sandbox Code Playgroud)

例如,height = 200,newHeight = 100将导致数据视图立即下降,使其顶部位于视口下方200px处,然后动画回到视口顶部.

我怎样才能让它改变高度?谢谢.

extjs sencha-touch sencha-touch-2

4
推荐指数
1
解决办法
4174
查看次数