Advertisement
gridphp

Custom edit type

Aug 22nd, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.89 KB | None | 0 0
  1.  
  2. Render Radio buttons as edittype
  3.  
  4. Radio buttons can be shown by custom method.
  5.  
  6.     $col = array();
  7.     $col["title"] = "Closing Rate";
  8.     $col["name"] = "closed";
  9.     $col["width"] = "30";
  10.     $col["editable"] = true;
  11.     $col["align"] = "center";
  12.     $col["editoptions"]["dataInit"] = "function(o){edit_as_radio(o);}";
  13.     $cols[] = $col;
  14.  
  15. ... and in html section, we can define custom edit-type display
  16.  
  17.     <script>
  18.     function edit_as_radio(o)
  19.     {
  20.         setTimeout(function(){
  21.             jQuery(o).replaceWith('<input type="hidden" id="closed" name="closed" value=""><input title="0" type="radio" name="rd_closed" value="0" onclick="jQuery(\'#closed\').val(0);"/>0 <input title="5" type="radio" name="rd_closed" value="5" onclick="jQuery(\'#closed\').val(5);"/>5 <input title="10" type="radio" name="rd_closed" value="10" onclick="jQuery(\'#closed\').val(10);"/>10');
  22.         },100);
  23.     }
  24.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement