Guest User

Untitled

a guest
Aug 6th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. If the options of dropdown are static, then you can connect onchange event of parent dropdown and reload the values of second dropdown using jquery.
  2.  
  3. $col["name"] = "firstcolumn";
  4. ...
  5. $col["editoptions"]["onchange"] = "function(){ update_second(); }"
  6.  
  7.  
  8. $col["name"] = "secondcolumn";
  9. ...
  10.  
  11. and in JS code
  12.  
  13. <script>
  14. function update_second()
  15. {
  16. if ($('#firstcolumn').val() == 1)
  17. {
  18. $('#secondcolumn').html('');
  19. $('#secondcolumn').append('<option value="cat-a">Cat A</option>');
  20. $('#secondcolumn').append('<option value="cat-b">Cat B</option>');
  21. $('#secondcolumn').append('<option value="cat-c">Cat C</option>');
  22. }
  23. else if ($('#firstcolumn').val() == 2)
  24. {
  25. $('#secondcolumn').html('');
  26. $('#secondcolumn').append('<option value="cat-a">Cat A</option>');
  27. $('#secondcolumn').append('<option value="cat-b">Cat B</option>');
  28. }
  29. }
  30. </script>
Add Comment
Please, Sign In to add comment