Get KoolPHP UI with 30% OFF!

reference KoolControls folder relatively

Michael
Hello,
I have a problem to reference the KoolControls folder relatively.
Here is my my folder tree:

I want to reference the KoolControls folder from my view/actors/index.php file
Here is my code:
<?php 
    /*
     * Please put this file in the same folder with KoolControls folder
     * or you may modify path of require and scriptFolder to refer correctly
     * to koolgrid.php and its folder.
     */
    require(dirname(__DIR__).'/common/KoolControls/KoolGrid/koolgrid.php');
    require(dirname(__DIR__).'/common/KoolControls/KoolAjax/koolajax.php');
    $koolajax->scriptFolder = dirname(__DIR__)."/common/KoolControls/KoolAjax";
        
    $ds = new ArrayDataSource($actors);
 
    $grid = new KoolGrid("grid");
    $grid->scriptFolder = dirname(__DIR__)."/common/KoolControls/KoolGrid";
    $grid->DataSource = $ds;
 
    $grid->styleFolder = dirname(__DIR__)."/common/KoolControls/KoolGrid/styles/default";
    $grid->Width = "655px";
    $grid->Height = "300px";
    $grid->PageSize = 25;
    $grid->AjaxEnabled = true;
    $grid->KeepRowStateOnRefresh = true;
    $grid->AllowScrolling = true;
    
    $column = new GridBoundColumn();
    $column->DataField = "first_name";
    $column->HeaderText = "Vorname";
    $column->Width = "45%";
    $grid->MasterTable->AddColumn($column);
    
    $column = new GridBoundColumn();
    $column->DataField = "last_name";
    $column->HeaderText = "Nachname";
    $column->Width = "45%";
    $grid->MasterTable->AddColumn($column);
    
    $column = new GridBoundColumn();
    $column->DataField = "actor_id";
    $column->HeaderText = "ID";
    $column->Width = "10%";
    $grid->MasterTable->AddColumn($column);
    
    $grid->MasterTable->AllowHovering = true;
    $grid->MasterTable->VirtualScrolling = true;
    $grid->MasterTable->AllowSelecting = true;
    $grid->MasterTable->AutoGenerateColumns = false;
    $grid->MasterTable->AutoGenerateDeleteColumn = false;
    $grid->MasterTable->AutoGenerateExpandColumn = false;
    $grid->MasterTable->Width = "655px";
    $grid->MasterTable->RowAlternative = true;
    $grid->MasterTable->Pager = new GridPrevNextAndNumericPager();
 
    $grid->Process();
?>
        <form id="form1" method="post"> <!-- You should render the grid inside a form tag, in case $grid->AjaxEnabled = false the grid needs a form to operate. -->
		<?php echo $koolajax->Render();?>
		<?php echo $grid->Render();?>
	</form>

and this is what i get, somehow a lot of functionality is not applied:

and this is how it should look like:

Actually I am not sure, if the code has other problems - it seems AJAX is not working, the pager does not work nor the theme is applied....???
Any suggestions?
Thanks in advance.
Posted Jul 4, 2016 , edited Jul 4, 2016 Kool
David
Hi Michael,
I think this is a problem of missing style. Can you try using the following command and let us know the result:
$grid->styleFolder = "default";

Edit: another problem is the scriptFolder path. This had better be an absolute path from public folder. In your code, this path is a file system path which KoolGrid won't be able to retrieve. So you could change the command to:
$grid->scriptFolder = "/views/common/KoolControls/KoolGrid";

Thanks for your feedback!
Posted Jul 5, 2016 , edited Jul 5, 2016 Kool
Michael
Hi David,
I think too, it is a problem of missing style and scriptFolder.
I tried your suggestions but they don't work...
Any better solutions?
Posted Jul 5, 2016 Kool
David
Hi Michael,
Would you please show your entire site's folder and file structure starting from your http server root? We would have to figure out the scriptFolder path from this structure. Thanks!
Posted Jul 6, 2016 Kool
Michael
awesome.
fixed as in http://www.koolphp.net/forum/threads/163.1/integrate-koolcontrols-in-codeigniter-php-framework.html
thanks
Posted Jul 7, 2016 Kool