Forum
10:30
01/04/2010
Hi!
We're making extensive use of jqGrid in one project, and have managed to get it to do a number of the things we wanted it to, including making a nice drop-down edit type and changing edit options based on which row is being edited. However, the latest thing I have need of has me stumped: I need to change the edittype of cell A when the value in cell B changes (in inline editing of one row). I haven't been able to find any docs or posts that hint at how to do this. While I can capture the change of value of cell B, I don't see how to change out the editor in the middle of the edit without making all manner of unfounded assumptions about what jqGrid does in editing. Is there a 'correct' way to do this?
Thanks in advance,
-Lars
17:03
Moderators
30/10/2007
Hello,
I'm not sure if this can be done with standart grid methods available.
One thing that I see is when the value of B cahnges get the current value of field A, then you know the id of the field A - remove the field and recreate it with the new input type using setCell method. Also the avilable edittype should be changed maybe (not sure from what edittype to what edittype is the change)
Little hard to do instead.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
21:01
01/04/2010
Thank you for your answer.
One problem is that since field B is being edited, I can't get the value of it - as far as I know - since it's been replaced with an edit thingie. I already know the id of field A, that's not a problem. The edittype of field A will need to be changed (between text and a custom dropdown type), and I don't know if a) that can be done while editing, and b) there's something cached for the column that'll prevent it from fully working.
So you're saying that if I just remove the field A and do setCell, the grid will pick up the fact that the row is being edited and automatically set the cell into edit mode? Must test that.
-Lars
12:52
01/04/2010
I finally figured out a way to do it, with a somewhat different approach. I make the HTML for cell B myself using custom_element, so I can hook in on it changing (it's a select menu). When it changes, I save the data, update the edit type, and re-select the row. It's a little messy, but it works.
-Lars
Most Users Ever Online: 715
Currently Online:
18 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66