Results 1 to 4 of 4

Thread: Get checkbox current checked or unchecked value

  1. #1
    Sencha User
    Join Date
    Mar 2014
    Posts
    3
    Answers
    1

    Default Answered: Get checkbox current checked or unchecked value

    In jQuery, I use
    Code:
    $('#id_of_checkbox').prop('checked')
    to know whether the checkbox is checked or not.

    How can I do this in ExtJS?

    I use Ext.form.FormPanel to build checkboxes, when I try to use
    Code:
    jQuery.prop
    I get always false, no matter it is checked or not.

    Here is a piece of code

    Code:
    {
        xtype: 'checkbox',
        fieldLabel: '<span style="color:red">{remove_product}</span>',id: 'disable_{counter}'                                                                            
    }
    Code:
    form2.findById('disable_'+i).getValue(); //this return undefined
    EDIT:

    I found out that I can use
    Code:
    getValue()
    But I CAN'T get correct value, maybe the DOM isn't ready or something?

    I try to get value after click a button.

  2. Sorry

    I found that it's db problem, not ext js.

    Very appreciate !

  3. #2
    Sencha User
    Join Date
    Mar 2011
    Location
    Hyderabad
    Posts
    106
    Answers
    10

    Default

    {
    xtype: 'checkbox',
    itemId: 'myCheckBox',
    name: 'myChk'
    }

    you can use the below code to get the value of check box

    1. Ext.ComponentQuery.query('checkbox[name=myChk]')[0].getValue();

    2.Ext.ComponentQuery.query('#myCheckBox')[0].getValue();


  4. #3
    Sencha User
    Join Date
    Mar 2014
    Posts
    3
    Answers
    1

    Default Still return false all of them

    Thanks for applying.

    I tried your answer.

    But it still return false .. all of checkbox. (I found that some of checkboxes is return correctly sometimes!)

    I use getValue() in button onclick handler.

    Could that be the reason that I can't get the value?

  5. #4
    Sencha User
    Join Date
    Mar 2014
    Posts
    3
    Answers
    1

    Default

    Sorry

    I found that it's db problem, not ext js.

    Very appreciate !

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •