Get KoolPHP UI with 30% OFF!

SyntaxError: expected expression, got '}'

Gerard
I try to cal a javascript whit text as parameter but got this error: SyntaxError: expected expression, got '}'
    $column = new GridTextAreaColumn();
    $column->DataField = "id";
    $column->HeaderText = "User ID";
    $column->Width = "100px";
    $grid->MasterTable->AddColumn($column);
    $column = new GridCommandColumn();
    $column->CommandText = "Show";
    $column->OnClick = "alert('hello world')";
    $column->CssClass = "button_css";
    $grid->MasterTable->AddColumn($column); 
    $column = new GridCommandColumn();
    $column->CommandText = "Show";
    $column->OnClick = "alert({id})";
    $column->CssClass = "button_css";
    $grid->MasterTable->AddColumn($column); 

With the alert({id}) that work but not with the alert('hello world')
Any idea?
ref: KoolGrid version 5.6.0.1
Posted Oct 23, 2017 , edited Oct 23, 2017 Kool
Anthony Amolochitis
Try to upgrade to the newest koolgrid and rerun the code.
It may fix it.
Posted Oct 24, 2017 Kool
Gerard
I just try with the trial 5.7.0.1 and same problem
Posted Oct 24, 2017 Kool
Anthony Amolochitis
Comment the row.
//$column->OnClick = "alert({id})";
Also try creating a different object for each column as well.
Then run it.
Posted Oct 24, 2017 , edited Oct 24, 2017 Kool
Gerard
Same thing :-(
Here the complete page code
<?php
    require_once "db_connect.php";
  
      // Gestion de du data via KoolGrid
    $KoolControlsFolder = "KoolControls";
    require $KoolControlsFolder . "/KoolAjax/koolajax.php";
    $koolajax->scriptFolder = $KoolControlsFolder . "/KoolAjax";
    require $KoolControlsFolder . "/KoolGrid/koolgrid.php";
    require $KoolControlsFolder . "/KoolGrid/ext/datasources/MySQLiDataSource.php";
         
    $ds = new MySQLiDataSource($con);
    $ds->SelectCommand = "SELECT id,username FROM hs_users";
    
    $grid = new KoolGrid("grid");
    $grid->scriptFolder = $KoolControlsFolder . "/KoolGrid";
    $grid->styleFolder="office2010blue";   //default    sunset   outlook   office2010blue
    $grid->DataSource = $ds;
    $grid->AjaxEnabled = true;
     
    //Show Function Panel
    $grid->MasterTable->ShowFunctionPanel = true;
    //Insert Settings
    $grid->MasterTable->InsertSettings->Mode = "Inline";
     
    $grid->MasterTable->Pager = new  GridPrevNextAndNumericPager(); 
    $grid->ColumnWrap = true;
    $grid->Width = "400px";
    $column = new GridTextAreaColumn();
    $column->DataField = "username";
    $column->HeaderText = "Username";
    $column->Width = "100px";
    $grid->MasterTable->AddColumn($column);
    
    $column = new GridCommandColumn();
    $column->CommandText = "Show with text";
    $column->OnClick = "alert('hello world')";
    $column->CssClass = "button_css";
    $grid->MasterTable->AddColumn($column); 
  
    
    $grid->Process();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta content="text/html; charset=utf-8" http-equiv="content-type">            
        <title>Gestion des utilisateurs</title>
    </head>
    <body>
        <section>
            <br>
            <form id="form1" method="post">
                <?php echo $koolajax->Render();?>            
                <div style="padding-top:10px;"  align="center">
                    <?php echo $grid->Render();?>
                </div>
            </form>
             <br><br>        
        </section>
    </body>
</html>
Posted Oct 26, 2017 , edited Nov 1, 2017 Kool