knockoutjs映射嵌套元素不绑定(knockoutjs mapping nested elements is not binding)
基本上看从ajax调用映射json。 我的js
var mapping = { create: function(options) { return new Person(options.data.id,options.data.name,options.data.surname,options.data.address,options.data.amounts); }, 'address': { create: function(options) { return new Address(options.data.id,options.data.street,options.data.number); } }, 'Amounts': { create: function(options) { return new Amount(options.data.id,options.data.price,options.data.iva); } } };
我收到一个错误:ReferenceError:fullAddress没有定义我的小提琴: http : //jsfiddle.net/2coj72yn/1/谢谢你的希望。
basically looking mapping a json from ajax call. my js
var mapping = { create: function(options) { return new Person(options.data.id,options.data.name,options.data.surname,options.data.address,options.data.amounts); }, 'address': { create: function(options) { return new Address(options.data.id,options.data.street,options.data.number); } }, 'Amounts': { create: function(options) { return new Amount(options.data.id,options.data.price,options.data.iva); } } };
I get an error : ReferenceError : fullAddress is not defined my fiddle: http://jsfiddle.net/2coj72yn/1/ Thanks for hope.
原文:https://stackoverflow.com/questions/27851817
更新时间:2022-09-15 12:09
最满意答案
试试这个,但在实现之前请阅读向后兼容性
public boolean dispatchKeyEvent(KeyEvent event) { final int keycode = event.getKeyCode(); final int action = event.getAction(); if (keycode == KeyEvent.KEYCODE_MENU && action == KeyEvent.ACTION_UP) { return true; // consume the key press } return super.dispatchKeyEvent(event); }
Try this, but before implement this please read Backwards Compatibility
public boolean dispatchKeyEvent(KeyEvent event) { final int keycode = event.getKeyCode(); final int action = event.getAction(); if (keycode == KeyEvent.KEYCODE_MENU && action == KeyEvent.ACTION_UP) { return true; // consume the key press } return super.dispatchKeyEvent(event); }
相关问答
更多-
您可以在应用程序启动时将声音静音,并在完成时取消静音 @override public void onResume(){ super.onResume(); AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE); mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true); } @override public void onPause(){ ...
-
我有同样的问题。 似乎是PhoneGap 2.0中的新默认值。 在src文件夹下的.java文件中(MainActivity.java似乎是默认文件名),注释掉onCreateOptionsMenu函数。 I had the same problem. Seems to be a new default in PhoneGap 2.0. In the .java file under the src folder (MainActivity.java appears to be the default fi ...
-
相关的代码行可以在PhoneWindowManager.java中找到 - > public int interceptKeyBeforeQueueing(KeyEvent event, int policyFlags, boolean isScreenOn) 。(在其他uplever应用程序可以处理之前调用它); 在判断KeyEvent代码后,它将调用mVibrator.vibrate(pattern[0]); 通过调用mVibrator = (Vibrator)context.getSystemServ ...
-
试试这个,但在实现之前请阅读向后兼容性 public boolean dispatchKeyEvent(KeyEvent event) { final int keycode = event.getKeyCode(); final int action = event.getAction(); if (keycode == KeyEvent.KEYCODE_MENU && action == KeyEvent.ACTION_UP) { return true; // consume the key ...
-
DrawerLayout.openDrawer(Gravity.LEFT)是你正在寻找的。 顺便说一句,我认为这不是一个糟糕的想法,因为很多人还不熟悉抽屉。 DrawerLayout.openDrawer(Gravity.LEFT) is what you are looking for. Btw I don't think that it is a bad think to do, since a lot of people is not familiar with the drawer yet.
-
我已经实现了一个遗留菜单按钮 做什么的? 如果您的应用程序是遗留应用程序,Android会自行处理这个问题,它会在Honeycomb上添加屏幕菜单按钮,因此您不需要打扰。 看到这篇文章: 告别菜单按钮 如果您的应用程序在没有专用菜单按钮的设备上运行,系统将根据您在清单元素中声明支持的API级别决定是否将操作溢出添加到导航栏。 逻辑归结为: 如果将minSdkVersion或targetSdkVersion设置为11或更高,系统将不会添加旧版溢出按钮。 否则,系统将在Android 3.0或更高版本上运行时添 ...
-
我认为这应该有效 查询框架,了解连接到设备的任何键盘上是否存在任何能够生成给定密钥代码的物理密钥。 boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK); Android开发者文档 I think this should work Queries the framework about whether any physical keys exist on the any keyboard attached to t ...
-
一种方法是显示一个对话框,其中LayoutParams类型设置为TYPE_SYSTEM_ERROR ,并将此对话框的所有者设置为“锁屏”活动以阻止主页按钮。 下面是一个如何做到这一点的示例: 更新:看起来这只适用于Android 4之前的版本。+ https://github.com/Joisar/LockScreenApp/blob/master/LockScreenApp/src/com/mehuljoisar/lockscreen/ utils的/ LockscreenUtils.java 另一种方法 ...
-
我建议你以编程方式增加/减少音量,这会有点容易,但是如果你想将它用于其他一些过程那么你可以检查下面的代码 - 编辑 - 我之前给出的片段不起作用,但是这个确实如此。 它使用runnable,因此try catch块是必需的。 new Thread(new Runnable() { @Override public void run() { try { Instrumen ...
-
除了它消失了,我无法弄清楚为什么 你摆脱了行动吧。 溢出功能显示在操作栏中,然后仅显示在缺少屏幕外MENU键的设备上。 在这个旧的Android开发者博客文章中可以找到对此的更长解释,以及在系统栏中有...可用性的一些遗留场景。 请问,这些天选项菜单上的派对线是什么? 如果您没有使用操作栏,请滚动自己的“菜单”构造。 except it went away and I can't figure out why You got rid of the action bar. The overflow affor ...