[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.
<?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();
?>
SIGN IN To post a reply.
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.
|
<?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.
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.
Regards,
Vignesh Natarajan.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
XR Xavier Reyes
- May 6, 2017 01:56 AM UTC
- May 12, 2017 05:24 AM UTC