Hi Abu,
I want to click add on the grid in inline mode.
New add row is added and I found the function afterInsertRow where I can do something.
But I dont have any idea how I can set default values on it depending on other columns.
for Example (after click on add):
3 Columns (1st Dropdown, 2nd Date, 3rd Text)
So if I press add I want to set default value on 3rd Column depending on selected entry on 1st Dropdown value)
So when I choose value 1 of Dropdown (1st column) I want to change value of the textbox (3rd column).
Is there any possibility to do so?
thx a lot, Gerhard
On first dropdown you can connect JS function on change event.
$col["editoptions"]["onchange"] = "update_field();"
and in html code:
<script>
function update_amount()
{
var v = parseFloat(jQuery("select[name=dd1].FormElement, select[name=dd1].editable").val());
// custom logic to change dd2
jQuery("select[name=dd2].FormElement, select[name=dd2].editable").val( v );
}
</script>
where dd1 is dropdown to pick value and dd2 is which need to be changed.
More info:
http://www.phpgrid.org/faqs/#80
https://gist.github.com/gridphp/db81eae4b5b9ce26bd59287ab13ad42c
thx Abu,
helped me a lot.
Is it also possible to set min and max for the second field depending on first field?
Example:
Dropdown Value = 2
Textfield depends on Dropdownvalue 2 == min 0.2 max 1.4
or do I have to write this in js then?
thx a lot.
Gerhard