Hi,
We stumbled upon a limitation of the grid and we'd like to suggest a fix.
The problem has to do with the grid and a custom field inside of it in inline editing grid (I haven't tested cell editing, but it's most likely the same). If we use, say, a DropDownList editor, the initial value will not be set.
The issue is that if we have a dropdownlist with an initial value, the user could leave it at that and submit the row. However, since the initial value was never changed, we'd be getting a "null" instead.
Our solution was to trigger the "change" event on the dropdown, which was enough to update the value into the grid's datasource.
I feel like this is unclear, so here's a jsfiddle : http://jsfiddle.net/jni_/3G7FK/
In the editor, I added a "see value" link that reads from the grid datasource. Add an item and click on it. You'll see that it alerts a 0. Change to value, and you'll be set. In edition mode, this is not a problem either.
Simply firing an initial "change" event will force the initial value to be taken into account.
Thanks,
Jni
PS : I'm sorry - I didn't realize there was a "grid" forum separate from the asp.net mvc grid. Can you please move it?
We stumbled upon a limitation of the grid and we'd like to suggest a fix.
The problem has to do with the grid and a custom field inside of it in inline editing grid (I haven't tested cell editing, but it's most likely the same). If we use, say, a DropDownList editor, the initial value will not be set.
The issue is that if we have a dropdownlist with an initial value, the user could leave it at that and submit the row. However, since the initial value was never changed, we'd be getting a "null" instead.
Our solution was to trigger the "change" event on the dropdown, which was enough to update the value into the grid's datasource.
I feel like this is unclear, so here's a jsfiddle : http://jsfiddle.net/jni_/3G7FK/
In the editor, I added a "see value" link that reads from the grid datasource. Add an item and click on it. You'll see that it alerts a 0. Change to value, and you'll be set. In edition mode, this is not a problem either.
Simply firing an initial "change" event will force the initial value to be taken into account.
Thanks,
Jni
PS : I'm sorry - I didn't realize there was a "grid" forum separate from the asp.net mvc grid. Can you please move it?