KoolGrid adds support for GridFileColumn.
<?php
$KoolControlsFolder = "../../../../KoolControls"; //Relative path to "KoolPHPSuite/KoolControls" folder
require $KoolControlsFolder . "/KoolAjax/koolajax.php";
$koolajax->scriptFolder = $KoolControlsFolder . "/KoolAjax";
require $KoolControlsFolder."/KoolGrid/koolgrid.php";
require $KoolControlsFolder."/KoolGrid/ext/datasources/MySQLiDataSource.php";
require $KoolControlsFolder . "/KoolUploader/kooluploader.php";
require $KoolControlsFolder . "/KoolCalendar/koolcalendar.php";
$ds = new MySQLiDataSource($db_con); //This $db_con link has been created inside KoolPHPSuite/Resources/runexample.php
$ds->SelectCommand = "select orderNumber,orderDate,status,comments, attachedfiles from orders";
$ds->UpdateCommand = "update orders set orderDate='@orderDate', status='@status', comments='@comments', attachedfiles='@attachedfiles' where orderNumber=@orderNumber";
$ds->DeleteCommand = "delete from orders where orderNumber=@orderNumber";
$grid = new KoolGrid("grid");
$grid->scriptFolder = $KoolControlsFolder . "/KoolGrid";
$grid->styleFolder = "sunset";
$grid->RowAlternative = true;
$grid->AjaxEnabled = true;
$grid->DataSource = $ds;
$grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
$grid->Width = "755px";
$grid->ColumnWrap = true;
$grid->AllowEditing = true;
$grid->AllowDeleting = true;
$grid->MasterTable->EditSettings->Mode = "form";
$column = new GridBoundColumn();
$column->DataField = "orderNumber";
$column->HeaderText = "Order number";
$column->ReadOnly = true;
$grid->MasterTable->AddColumn($column);
$column = new GridDateTimeColumn();
$column->DataField = "orderDate";
$column->HeaderText = "Order date";
$column->FormatString = "M d, Y";
$column->Width = '100px';
//Assign datepicker for GridDateTimeColumn
$column->Picker = new KoolDatePicker();
$column->Picker->scriptFolder = $KoolControlsFolder . "/KoolCalendar";
$column->Picker->styleFolder = "sunset";
$column->Picker->DateFormat = "M d, Y";
$grid->MasterTable->AddColumn($column);
$column = new GridDropDownColumn();
$column->DataField = "status";
$column->HeaderText = "Status";
$column->AddItem("In Process");
$column->AddItem("On Hold");
$column->AddItem("Disputed");
$column->AddItem("Cancelled");
$column->AddItem("Resolved");
$column->AddItem("Shipped");
$grid->MasterTable->AddColumn($column);
$column = new GridBoundColumn();
$column->DataField = "comments";
$column->HeaderText = "Comments";
$grid->MasterTable->AddColumn($column);
$kul = new KoolUploader('');
echo $kul->RegisterScript(false);
$column = new GridFileColumn();
$column->DataField = "attachedfiles";
$column->HeaderText = "Attached files";
$column->KoolUploaderFolder = $KoolControlsFolder . "/KoolUploader/";
$column->Width = '180px';
$column->AllowedExtension = "gif,jpg,doc,pdf,txt";
$column->BaseDirectory = '.';
$column->TableName = 'orders';
$column->IdColumn = 'orderNumber';
$column->MultipleUpload = true;
$column->AllowDelete = true;
$grid->MasterTable->AddColumn($column);
$kulhandle = new KoolUploadHandler();
$kulhandle->allowedExtension = "gif,jpg,doc,pdf,txt";
$kulhandle->allowDelete = true;
echo $kulhandle->handleUpload();
$column = new GridEditDeleteColumn();
$column->HeaderText = "Edit/Delete";
$column->Align = "center";
$grid->MasterTable->AddColumn($column);
$grid->Process();
?>
<form id="form1" method="post">
<?php echo $koolajax->Render(); ?>
<?php echo $grid->Render(); ?>
<div style="margin-top:10px;"><i>* <u>Note</u>:</i>Generate your own grid with <a style="color:#B8305E;" target="_blank" href="http://codegen.koolphp.net/grid/">Code Generator</a></div>
</form>