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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

130323 May 6,2017 01:56 AM UTC May 12,2017 05:24 AM UTC PHP 3
loading
Tags: Grid
Xavier Reyes
Asked On May 6, 2017 01:56 AM UTC

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.

<?php
    $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();
    $col2->field('nombre')->headerText('Nombre')->editType('numericedit');
    $col3 = new EJ\Grid\Column();
    $col3->field('activo')->headerText('Activa')->textAlign('center')->edittype('dropdownedit')->width(150);
    $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";
    $dataManager->url($url.'?action=getData')->removeurl($url.'?action=delData')->updateurl($url.'?action=updateData')->inserturl($url.'?action=insertData')->adaptor('UrlAdaptor');
    echo $grid -> dataSource($dataManager)->allowPaging(true)->columns($gridColumns)->editSettings($edit->allowEditing(true)->allowDeleting(true)->allowAdding(true))->toolbarSettings($toolbar->showToolbar(true)->toolbarItems($toolbarItems))->render();
    ?>



Saravanan Arunachalam [Syncfusion]
Replied On 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. 
<?php 
     
    $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 
 
        } 
 
Regards, 
Saravanan A. 


Xavier Reyes
Replied On May 11, 2017 04:39 PM UTC

It works very well.

Thank you so much


Vignesh Natarajan [Syncfusion]
Replied On 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.   
  
Regards, 
 
Vignesh Natarajan. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;