0

I have been following this example, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm, as it is just what I need. I have got it working but it doesnt work when scrolling through records. If you bring up the form and scroll from a UK record to a US record, the list doesnt change. The onChange event only fires when the user selects from the select drop down.

Is there a way around this?

Thanks for your help.

James

JC75
  • 77
  • 2
  • 4
  • 12
  • what you mean under "scrolling"? Do you use scroll button of the mouse or you mean the usage of the keyboard? – Oleg Feb 06 '12 at 16:24
  • If you click edit selected row and then use the arrows to go to the next record, if you go from records 2 to 3 the country changes from UK to US but the State stays as Oxford. The change event doesnt seem to fire. Thanks for your help. – JC75 Feb 06 '12 at 16:40

1 Answers1

0

My old demo uses 'change' event handler defined in the dataEvents property of the editoptions. In the dataEvents array one can define other event handlers.

You need just bind keyup to the column exactly like it's described in the answer. In the body of the event handler you can do the same actions as in the body of the 'change' event handler (you can place the code in a function and call it from the both handlers). In the way you should be able to solve the problem.

UPDATED: I updated the old answer and another one which was origin for the demo which you used. The new demo support the navigation buttons (the buttons to edit the 'next' or the 'previous' row) in the editing form.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • OK. I will try it tomorrow. Im new to this so it might take me a while to figure out how to do what you said. Im assuming keyup will cover the clicking of the navigation arrows on the edit form? Doesnt sound right to me but I will try it! Thanks for your help, I think i will need all the help I can get! Thanks – JC75 Feb 06 '12 at 18:04
  • @JC75: If you bind `keyup` to the column which has `edittype: 'select'` then only typing on the keys in the select element will be handled. So if the focus is on the ` – Oleg Feb 06 '12 at 18:11
  • Hi Oleg. But the keyup event only fires when i press a key. I may not be explaining myself well. If you look at your example again, http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm, if you click on record 2 'Oscar Wilde' and then click the edit button to bring up the form. If you then click the arrow to go to Record 3 'Louise Fletcher', the Country changes but the State doesnt. WHich event fires when I got to the next record? Thanks again – JC75 Feb 07 '12 at 09:09
  • @JC75: Sorry, but [the demo](http://www.ok-soft-gmbh.com/jqGrid/DependendSelects2.htm) has no arrow in the Edit form. The problem dependent select is complex enough and the Next/Previous row are not really needed. So I prefer just use [viewPagerButtons: true](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#properties) option to disable the buttons. Alternatively one have to write additional code for [onclickPgButtons](http://www.trirand.com/jqgridwiki/doku.php?id=wiki:form_editing#events) which reset the select. – Oleg Feb 07 '12 at 11:18
  • Hi Oleg, Thanks for your help. I took your advice of disabling the navigation buttons. Worked perfectly. Thanks again – JC75 Feb 07 '12 at 13:20
  • @JC75: You are welcome! I am working on modifying of my demo to support navigation buttons. I will inform you about after I finish the modification. – Oleg Feb 07 '12 at 14:04
  • @JC75: The modified the demo. See "UPDATED" part of my answer. – Oleg Feb 07 '12 at 14:55
  • Hi Oleg. Sorry but I am now having a problem that I am trying to get the function that fires on the change event to fire when the edit form first loads. So I can fill my second dropdown based on the first. I am using dataurl but the value of the first select drop down isnt available until after the form has loaded? Should I post another question? Thanks – JC75 Feb 07 '12 at 17:17