-
19 Nov 2010 3:08 PM #1
Ext.form.Toggle - setValue issue
Ext.form.Toggle - setValue issue
Hello all,
I am not certain if I am doing this wrong or not, but when I try to a setValue on a toggle (or a slider for that matter), I get the following error:
The code fails already on this one:Code:JavaScript Error on Line 6 http://localhost/sencha/sencha-touch.js TypeError: Result of expression 'c.dragObj' [undefined] is not an object
I have tried this with multiple ways of notation, including setValue(0, 0, true).Code:var checkInToggle = new Ext.form.Toggle( { value: 1 }); checkInToggle.setValue(0);
It keeps giving me that error.
Any help is appreciated.
Kind regards, Mathos.
-
20 Nov 2010 12:31 AM #2
-
8 Feb 2011 11:28 AM #3
problems in Ext.form.Toggle
problems in Ext.form.Toggle
when i call this
i get this Uncaught TypeError: Cannot read property 'offsetBoundary' of undefinedCode:var toggle_meal = new Ext.form.Toggle({ id: 'toggle_me', title: 'Log Meal', cls: 'ml10 mr10 rounded bordAll', maxValue: 1, minValue: 0 }); toggle_meal.setValue(1);
-
8 Mar 2011 3:03 AM #4
This seems to always happen if a togglefield is set before it (or its containing form) is rendered. E.g. when loading a model into form that has not yet been displayed.
The bug still exists in Sencha Touch version 1.0.2.
--
Oyvin
-
8 Mar 2011 3:34 AM #5
Here's a small hack (NOTE: It does NOT work exactly like setValue/getValue!) to postpone value setting until the field has been rendered:
--Code:xtype: 'togglefield', plugins: { init: function (c) { var origGet = c.getValue, origSet = c.setValue, reverter = function () { c.getValue = origGet; c.setValue = origSet; c.setValue(c.value); c.un('afterrender', reverter); }; c.on('afterrender', reverter); c.setValue = function (value) { c.value = value; }; c.getValue = function () { return c.value; };
Øyvin
-
24 Oct 2011 7:16 AM #6
-
29 Feb 2012 2:40 PM #7
Bug still exists in 1.1.1.
frankeys solution didn't work for me. oyvinht's did (just make sure you add the two missing brackets at the end!)
Similar Threads
-
[FIXED-522] toggle.setValue() doesn't properly update UI slider
By iffius in forum Sencha Touch 1.x: BugsReplies: 3Last Post: 10 Apr 2013, 1:11 PM -
Toggle component's setValue & toggle functions give an error
By ncanton in forum Sencha Touch 1.x: DiscussionReplies: 0Last Post: 28 Oct 2010, 10:35 PM -
Toggle.setValue() and NestedList.Add() Problems
By SuperTron in forum Sencha Touch 1.x: DiscussionReplies: 1Last Post: 30 Jul 2010, 9:51 PM -
setvalue Event on Ext.form.ComboBox
By plalx in forum Ext 3.x: Help & DiscussionReplies: 1Last Post: 13 May 2010, 12:16 PM -
get/setValue on Ext.form.TimeField
By alexdemers in forum Ext 3.x: Help & DiscussionReplies: 3Last Post: 17 Dec 2009, 9:59 AM


Reply With Quote