I am using ExtJs 4.1. My page is having a combobox and a button. The comboxbox is having a store which uses a model having 4 fields (UserName,ID (uniqueID),Age,Salary). Name is used as display field and Id is used as value field.
What i want:
When the button is clicked I want to see the selected value in the comboxbox and I want to extract the salary.
Possible solution: Get the id of the selected value from the combobox and find the record in the store and extract the salary for that record.
I was wondering if there is more direct approch or method exposed by ExtJS
on combobox select you can get the salary value like this:
onComboboxSelect: function(combo, records, options) {
var selectedValue=combo.getValue();
var record = combo.findRecord(combo.valueField || combo.displayField, selectedValue);
alert(record.get('salary'));
}
I think this is the important then you can for example save this value and display it when the button is clicked..
Related
I have a list with several rows and columns. Each row has a button called "Show Trail Details".
During the test, i click twice on the "Date" column title, to have the latest entry in the list in the first row.
I need to get the ID of the button inside the first row.
The IDs are changing all the time. So its either:
//tbody/tr[1]/td[6]/button[1]/span[1] or //tbody/tr[1]/td[4]/button[1]/span[1] and so on.
I tried to copy the HTML, but it looks weird when i run the html code.
The inspect looks like this:
Is there any way how to get that ID?
Thanks!
I need to get the ID of the button inside the first row.
But there's no "id" attribute on either the td, button, or span elements?
Or do you mean the '_b1_685ddfc4-de...' attribute?
If the id is just a means of getting access to the first button then you could just use something like:
WebElement firstShowTrailDetailsButton = driver.findElements(By.cssSelector("td[style='text-align:right'] button.mud-button")).get(0);
I have defined an extended product view which uses a checkbox field to define that a product has certain attributes.
I would like that when user clicks on that checkbox a given value in Units of Measure dropdown field is automatically selected.
So, how do I select a value on a dropdown list when user clicks on a checkbox? (same view).
Thanks
It should be done by onchange method. You can define new boolean fields in that model and need to write onchange function for that.
#api.onchange('boolean_field1','boolean_field2')
def onchange_boolean(self):
if self.boolean_field:
self.product_uom_id = product_uom_record_id
else:
self.product_uom_id = product_uom_record_id
#Your custom code
Here,
product_uom_record_id : you need to search product uom record and set it there. Make sure you must assign ID not the object (browsable
record)
By this way you can call this function while onchange happen on this boolean field.
My program uses a database in access which consists of BreedID and BreedName. I have a dropdown box in vb.net which shows the name for the user to select, however in my code I would like to store the ID related to that name so that I can send it over to the access database using oledb. Currently this is what it looks like:
Dim BrVar As String = Breed.SelectedItem.Text
But that isn't working! Please help!
You can add hidden columns to your dropdown box, it may already exist. The first column in a dropdown box is column(0) and you can set the width to 0cm. This can be for the ID value. Leaving column(1) for the Name value.
Then you can use Breed.SelectedItem.column(0)
The first thing to do is on the Data tab set up your rowsource to SELECT both the BreedID and BreedName fields (in that order). Then make sure bound column is set to 1.
Then on the Format tab set Column Count to 2 and Column Widths to 0;1.
That will have the result of displaying the BreedName field but using the BreedID field as the value of the combo box.
Use Dim BrVar As Long = Breed.SelectedItem to get the value of BreedID.
I am trying to get the values of form elements in sencha touch. I am using
fields= form.getFields();
var name = fields["name"].getValue();
This is working for most of my fields, but not for my radio button field.
I am using two radio fields with the same name of 'gender' that have values of male or female. I tried the above code for this field, but I get an error that the radiofield has no method getValue(). However, in the sencha touch documentation under Ext.form.radio it says that radio does have the method. What is the correct way to get the value of a radio group?
Try
var fields = form.getValues();
console.log(fields['name']);
I've a dijit.form.Combobox field which uses a ItemFileReadStore to pull Its data.
Teh ItemFileReadStore has two attribute per Item value which will be used for form submission , generally Unique Integers and label which is Human Understandable String.
In ComboBox HTML I've done searchAttr="value" labelAttr="label"
When the ComboBox Shows the list it uses teh label Attribute.
But When the User selects one of the Item it shows the value of that Item.
What I want is , The value Attribute will Still be used for Form Submission. But the User will always see the label in the combobox Control.
alt text http://img822.imageshack.us/img822/6660/dijitcombo.jpg
e.g. I Want to Show The Label for value 3 (Admin) instead of 3
Use FilteringSelect instead of Combobox.
Note: ComboBox only has a single value that matches what is displayed while FilteringSelect incorporates a hidden value that corresponds to the displayed value.
I have tried the following.
var cmbObject = Registry.byId('combo dojo id'); var id =
cmbObject.item.<Code Property>;
You should check if item is null.