SegmentedC & amp; #8203; obtain the selected content of the ontrol control (BB10 Cascades Beta

Source: Internet
Author: User

In the BB10 Cascades development environment, you can use the SegmentedControl control to present a horizontally placed single-choice component. In BB10 Cascades, you can use the Object id. the selectedValue () method is used to obtain the selected options.
The official example is as follows. However, this example runs successfully only on BB10 Cascades Beta2. If you use the following code on BB10 Cascades Beta3, the following error will be reported:
TypeError: Result of expression 'segmented1. selectedValue '[1] is not a function.
 
To solve the problem, replace "Object id. selectedValue ()" with "selectedValue", because in onSelectedIndexChanged, selectedValue directly gives the selected content.
The following error code is displayed:
[Javascript]
SegmentedControl {
Id: segmented1
Option {
Id: option1
Text: "option 1"
Value: "option1"
Selected: true
}
Option {
Id: option2
Text: "option 2"
Value: "option2"
}
Option {
Id: option3
Text: "option 3"
Value: "option3"
}
OnSelectedIndexChanged :{
Var value = segmented1.selectedValue ()
Console. debug ("Selected value:" + value );
}
}

The following is the code that can be run on Cascades Beta3. Pay attention to the row selectedValue.
[Javascript]
SegmentedControl {
Id: segmented1
Option {
Id: option1
Text: "option 1"
Value: "option1"
Selected: true
}
Option {
Id: option2
Text: "option 2"
Value: "option2"
}
Option {
Id: option3
Text: "option 3"
Value: "option3"
}
OnSelectedIndexChanged :{
Var value = selectedValue;
Console. debug ("Selected value:" + value );
}
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.