1. #1
    Sencha User
    Join Date
    Sep 2007
    Posts
    13
    Vote Rating
    0
    mathos is on a distinguished road

      0  

    Default 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:
    Code:
    JavaScript Error on Line 6
    http://localhost/sencha/sencha-touch.js
    TypeError: Result of expression 'c.dragObj' [undefined] is not an object
    The code fails already on this one:
    Code:
    var checkInToggle = new Ext.form.Toggle(
    {
    	value: 1
    });
    
    checkInToggle.setValue(0);
    I have tried this with multiple ways of notation, including setValue(0, 0, true).
    It keeps giving me that error.

    Any help is appreciated.

    Kind regards, Mathos.

  2. #2
    Sencha User
    Join Date
    Sep 2007
    Posts
    13
    Vote Rating
    0
    mathos is on a distinguished road

      0  

    Default


    Could this be related to This issue/bug
    ??

    Kind regards, Mathos.

  3. #3
    Sencha User
    Join Date
    Dec 2010
    Posts
    81
    Vote Rating
    0
    babar.sajjad is on a distinguished road

      0  

    Exclamation problems in Ext.form.Toggle

    problems in Ext.form.Toggle


    when i call this
    Code:
    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);
    i get this Uncaught TypeError: Cannot read property 'offsetBoundary' of undefined

  4. #4
    Touch Premium Member
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    14
    Vote Rating
    0
    oyvinht is on a distinguished road

      0  

    Default


    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

  5. #5
    Touch Premium Member
    Join Date
    Sep 2010
    Location
    Norway
    Posts
    14
    Vote Rating
    0
    oyvinht is on a distinguished road

      0  

    Default


    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

  6. #6
    Sencha User frankeys's Avatar
    Join Date
    Dec 2010
    Posts
    10
    Vote Rating
    0
    frankeys is on a distinguished road

      0  

    Default


    try checkInToggle.value = 1;

    works for me

  7. #7
    Sencha User
    Join Date
    Nov 2011
    Posts
    72
    Vote Rating
    0
    kalor is on a distinguished road

      0  

    Default


    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

  1. [FIXED-522] toggle.setValue() doesn't properly update UI slider
    By iffius in forum Sencha Touch 1.x: Bugs
    Replies: 3
    Last Post: 10 Apr 2013, 1:11 PM
  2. Toggle component's setValue & toggle functions give an error
    By ncanton in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 28 Oct 2010, 10:35 PM
  3. Toggle.setValue() and NestedList.Add() Problems
    By SuperTron in forum Sencha Touch 1.x: Discussion
    Replies: 1
    Last Post: 30 Jul 2010, 9:51 PM
  4. setvalue Event on Ext.form.ComboBox
    By plalx in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 13 May 2010, 12:16 PM
  5. get/setValue on Ext.form.TimeField
    By alexdemers in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 17 Dec 2009, 9:59 AM

Thread Participants: 4

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar