Get KoolPHP UI with 30% OFF!

Example on how to create a custom form for editing and inserting

Scott
Does there exist a code example on how to configure KoolGrid to use a custom HTML form for editing and Inserting.
I see the option for inline vs form, but nothing for using different HTML to render the form.
Posted Aug 26, 2015 Kool
Abraham
Hi there Scott i think you are looking for this:
http://doc.koolphp.net/Controls/KoolGrid/PHP/InsertSettings/index.php#Template
<?php				
	//Create inserting template.
	...
	class MyInsertTemplate implements GridTemplate
	{
		function Render($_row)
		{
			$html  = "<input id='city_input'  name='city_input' type='text' />"; User input
			$html .= "<input type='button' value='Confirm' onclick='grid_confirm_insert(this)'/>"; //Render confirm button.
			$html .= "<input type='button' value='Cancel' onclick='grid_cancel_insert(this)'/>"; //Render cancel button.
			return $html;
		}
		function GetData($_row)
		{
			return array("city"=>$_POST["city_input"]);
		}		
	}
	...
	$grid->MasterTable->InsertSettings->Mode = "Template";
	$grid->MasterTable->InsertSettings->Template = new MyInsertTemplate();
	...
 
?>
Posted Aug 26, 2015 Kool -
Peter
In addition to Abraham good answer, GridTemplate can be used for both Inserting and Editing.
Here is a small working example which uses GridTemplate:
http://demo.koolphp.net/Examples/KoolGrid/Advanced/Ajax_Template/index.php
In above example, we build a custom Inserting with capability of loading countries list via ajax for user to select.
Hope that help.
Regards,
Peter
Posted Aug 27, 2015 Kool