Results 1 to 10 of 10

Thread: Radiofield bnding

  1. #1
    Sencha Premium Member
    Join Date
    Mar 2013
    Posts
    5

    Default Radiofield bnding

    Hi,

    This question regarding Ext JS 6.1 modern toolkit

    How do I bind value to radiofield? I have tried several ways, not working.

    My goal is to identify which radio button is selected. Here is what I have.


    {
    xtype: 'radiofield',
    name : 'func',
    value: 'Pay',
    width: '250',
    label: 'View Payments',
    bind: {value: {func}}
    checked: false
    },

  2. #2
    Sencha User alex.volfson's Avatar
    Join Date
    Jan 2016
    Posts
    462
    Answers
    60

    Default

    You are binding value, but setting checked to false. Also your bind expression should be in quotes. Here is a working example:

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    665

    Default

    Is there any reason why data binding doesn't support full expressions i.e.

    Code:
    bind: {
      checked: '{myval} || {myotherval}'
    }
    From what I've read in the forums, that was by design and for those types of use cases, the logic should be wrapped in formulas in the viewModel to keep your view less cluttered. Am I correct in assuming that?

  4. #4
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353
    Answers
    13

    Default

    We can't bind the checked property in classic, unfortunately :-(

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892
    Answers
    41

    Default

    That's a bug then. It should be bindable if there's a getter and a setter.

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

    Default

    Quote Originally Posted by marc.fearby View Post
    We can't bind the checked property in classic, unfortunately :-(
    You can. I am binding to it. If it doesn't work for you, create a fiddle showing the issue.

  7. #7
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353
    Answers
    13

    Default

    Quote Originally Posted by hakimio View Post
    You can. I am binding to it. If it doesn't work for you, create a fiddle showing the issue.
    The docs still don't have a "bindable" flag beside this property in 6.5.2: http://docs.sencha.com/extjs/6.5.2/c...ml#cfg-checked

    In any case, I've solved my problem and don't need to bind to "checked". I just had to make sure I was setting the value to the radiogroup as a string, and not a boolean (my inputValues are 'true' and 'false').

  8. #8
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

    Default

    Quote Originally Posted by marc.fearby View Post
    The docs still don't have a "bindable" flag beside this property in 6.5.2: http://docs.sencha.com/extjs/6.5.2/c...ml#cfg-checked

    In any case, I've solved my problem and don't need to bind to "checked". I just had to make sure I was setting the value to the radiogroup as a string, and not a boolean (my inputValues are 'true' and 'false').
    You can set "inputValue" and "uncheckedValue" configs to whatever you want and docs are not always accurate.

  9. #9
    Sencha Premium User
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    1,353
    Answers
    13

    Default

    Quote Originally Posted by hakimio View Post
    You can set "inputValue" and "uncheckedValue" configs to whatever you want and docs are not always accurate.
    I did that to the "checked" property using "process config" in Sencha Architect but the app crashed, complaining that there is no setChecked() method so therefore I can't bind it. But I'm not going to create a fiddle for it, since it's no longer a problem as far as I'm concerned. Strange that it seems to work for you, though. I'm still using 6.2 for this particular app, so maybe they've made it bindable in 6.5 but haven't yet updated the docs.

  10. #10
    Sencha User
    Join Date
    Apr 2013
    Posts
    914
    Answers
    105

    Default

    Quote Originally Posted by marc.fearby View Post
    I did that to the "checked" property using "process config" in Sencha Architect but the app crashed, complaining that there is no setChecked() method so therefore I can't bind it. But I'm not going to create a fiddle for it, since it's no longer a problem as far as I'm concerned. Strange that it seems to work for you, though. I'm still using 6.2 for this particular app, so maybe they've made it bindable in 6.5 but haven't yet updated the docs.
    Sorry, you can bind to it but only one way - there is getChecked() but setChecked() is missing even in 6.5.2 .

Similar Threads

  1. Centering radiofield tickmark for hbox type radiofield
    By margafred in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 30 Dec 2013, 4:32 PM
  2. Prefilling radiofield
    By mikel1982 in forum Sencha Touch 2.x: Q&A
    Replies: 2
    Last Post: 26 Jul 2012, 7:11 PM
  3. radiofield=on
    By moimoibis in forum Sencha Touch 2.x: Discussion
    Replies: 1
    Last Post: 25 Apr 2012, 4:33 AM
  4. radiofield size
    By asifshaikh in forum Ext: Q&A
    Replies: 4
    Last Post: 7 Mar 2012, 5:40 AM
  5. [2.0][DUP][CLOSED] Radiofield
    By rob.versluis in forum Ext 2.x: Bugs
    Replies: 1
    Last Post: 3 Jan 2008, 8:35 AM

Posting Permissions

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