- Sat Jul 28, 2018 4:03 am
#815382
Good day,
I'm trying to use a Dropdown in a Grid. The dropdown populates from a DB using a SQL command (this works fine). I'm trying to get the value of what the user has selected from the dropdown. I can't seem to select the dropdown on its own and use getText() as it always returns null (the field is editable).
Instead I have to check when the grid is changed, and then get the value from the dropdown, which in this case is a first column field.
What would be the best way to get the current value of a (dropdown) field in a Grid?
I'm trying to use a Dropdown in a Grid. The dropdown populates from a DB using a SQL command (this works fine). I'm trying to get the value of what the user has selected from the dropdown. I can't seem to select the dropdown on its own and use getText() as it always returns null (the field is editable).
Code: Select all
$("#myDropdown").getText(1,1);
Instead I have to check when the grid is changed, and then get the value from the dropdown, which in this case is a first column field.
Code: Select all
The problem with this code is that it returns the value of what was previously displayed in the Dropdown, not what the user has currently selected. Even getValue(1,1) returns the previous key, not the current one.$("#form\\[myGrid\\]\\[1\\]\\[myDropdown\\]").change( func );
function func (){
var myVar = $("#myGrid").getText (1,1);
alert(myVar);
}
What would be the best way to get the current value of a (dropdown) field in a Grid?