We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

[SOLVED] Is it possible to have a read-only column?

Hi community, Is it possible to have a read-only column?, I have my GRID and I would like "id_seccion" to be read-only and AutoValue When adding an item.

    $col1 = new EJ\Grid\Column();
    $col1->field('id_seccion')->headerText('Id de la Seccion')->textAlign('center')->isPrimaryKey(true)->width(150)->;
    $col2 = new EJ\Grid\Column();
    $col3 = new EJ\Grid\Column();
    $gridColumns = array($col1,$col2,$col3);
    $grid =  new EJ\Grid('Grid');
    $edit =new EJ\Grid\EditSetting();
    $toolbarItems = array("add","edit","delete","update","cancel");
    $toolbar= new EJ\Grid\ToolbarSetting();
    $dataManager  = new EJ\DataManager();
$url = "http://sekaisoft.com/navigation/db_select_seccion.php";
    echo $grid -> dataSource($dataManager)->allowPaging(true)->columns($gridColumns)->editSettings($edit->allowEditing(true)->allowDeleting(true)->allowAdding(true))->toolbarSettings($toolbar->showToolbar(true)->toolbarItems($toolbarItems))->render();

3 Replies

SA Saravanan Arunachalam Syncfusion Team May 8, 2017 07:33 AM UTC

Hi Xavier, 
Thanks for contacting Syncfusion’s support. 
 In server-side CRUD operation with an Identity Column (AutoIncrement) in database table, we can have auto increment Grid column using “IsIdentity” Grid Column Property. Please refer the following code example. 
    $col1->field('id_seccion')->headerText('Id de la Seccion')->textAlign('center')->isIdentity(true)->isPrimaryKey(true)->width(150)->; 
    . . . 
During add operation, the Identity column would be disabled and on save, the record would be updated with the incremented value obtained from server-side database. Please refer to the below online documentation link. 
Note: If the identity field in database table specified with auto increment, it will automatically set the value for the identity field otherwise we need to handle the auto increment as like below skeleton. 
public ActionResult InsertData(EditableOrder value) 
            //Get id_section of last record 
            //Increment it and assign it as value.id_section 
            //return the modified value 
Saravanan A. 

XR Xavier Reyes May 11, 2017 04:39 PM UTC

It works very well.

Thank you so much

VN Vignesh Natarajan Syncfusion Team May 12, 2017 05:24 AM UTC

Hi Xavier, 
We are happy to hear that your problem has been solved. 
Please get back to us if you need any further assistance.   
Vignesh Natarajan. 

Live Chat Icon For mobile
Up arrow icon