Can you please explain how this works? It always seems to render as a null column, no matter what the value of $col["editoptions"].
The documentation seems somewhat silent on the matter.
Hi,
Only certain edittypes are allowed.
However you can use $col["default"] to specify any html you want in cell, so you can put
$col["default"] = "<button> …. ";
For reference, please check demo > appearence > custom-buttons.php
OK. However, the documentation here (http://www.phpgrid.org/docs/) says…
Render as button
$col["edittype"] = "button";
$col["editoptions"] = array("value"=>'Click Me');
…is the doc incorrect or just incomplete?
I think there is some confusion.
The edittype > button, will show button when the record is in edit mode, and it work with this code, and not in display mode.
$col = array();
$col["title"] = "Button"; // caption of column
$col["name"] = "button";
$col["width"] = "50";
$col["editable"] = true;
$col["edittype"] = "button";
$col["editoptions"] = array("value"=>'Click Me');
$cols[] = $col;
If you wish to display button in display mode (non-edit), you have to use this property.
$col["default"] = "<button> …. ";
For $col["default"], you can refer the demo of custom-button.php
(Licensed Version)
Hello, and what if i want that the
$col["default"] = 'my html code'
shows only when the user doubleclick the field to edit it?
You can set:
$col["editoptions"]["dataInit"] = "function(o){edit_custom(o);}";
$cols[] = $col;
… and in html section, we can define custom edit-type display
<script>
function edit_custom(o)
{
setTimeout(function(){
jQuery(o).replaceWith('my html code');
},100);
}
</script>
Refer docs: Render Radio buttons as edittype